Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs1-24fa
lecture-code
Commits
7c74fea7
Commit
7c74fea7
authored
5 months ago
by
Adam Blank
Browse files
Options
Download
Email Patches
Plain Diff
Add new file
parent
f3e61c00
master
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
02/game.py
+50
-0
02/game.py
with
50 additions
and
0 deletions
+50
-0
02/game.py
0 → 100644
View file @
7c74fea7
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
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help