game.py 1.63 KB
from util import play
import time
from scripts import GO_TO_SLEEP_SCRIPT, role_script, close_eyes_script, WAKE_UP_SCRIPT

WAKING_ROLES = ['werewolves', 'minion', 'masons', 'seer',
                'robber', 'troublemaker', 'drunk', 'insomniac']
NON_WAKING_ROLES = ['villager', 'hunter', 'tanner']

ALL_ROLES = WAKING_ROLES + NON_WAKING_ROLES


def check_roles(some_roles):
    return False


def is_valid_game(some_roles):
    """
    This function checks if the provided list of roles can make
    a valid game of one-night werewolf. To be valid, a role list
    must consist of only valid roles (Those in the `ALL_ROLES`
    list) and the role list must contain "werewolves".

    Args:
        some_roles (list[str]): A proposed list of roles for a one-
            night werewolf game.

    Returns:
        bool: `True` when `some_roles` represents a valid game of 
            one-night werewolf and `False` otherwise.
    """
    return False


def announcer(roles):
    """
    Generates a script for the announcer in a one-night werewolf
    game and plays it out loud on the computer's speakers.
    If the list of `roles` is invalid, the entire script should 
    consist of "That's not a valid set of roles!".  Otherwise,
    the announcer plays the `GO_TO_SLEEP_SCRIPT`. Then,
    for each **waking** role, the announcer (0) plays the script 
    for that role, (1) waits for one second, and (2) prints the 
    "close_eyes_script" for that role.  After playing every 
    role's script, the announcer plays the `WAKE_UP_SCRIPT`.

    Args:
        roles (list[str]): A proposed list of roles for a one-night
            werewolf game.
    """
    pass