Spaces:
Sleeping
Sleeping
Kim Adams commited on
Commit ·
3b46464
1
Parent(s): 2f6fe1e
fixing game theme logic
Browse files
create_games/__pycache__/create_games_slack.cpython-311.pyc
CHANGED
|
Binary files a/create_games/__pycache__/create_games_slack.cpython-311.pyc and b/create_games/__pycache__/create_games_slack.cpython-311.pyc differ
|
|
|
create_games/create_games_slack.py
CHANGED
|
@@ -40,19 +40,24 @@ def FindCommonTheme(people_set):
|
|
| 40 |
theme_counter = Counter()
|
| 41 |
for person in people_set:
|
| 42 |
if person in themes_by_person:
|
| 43 |
-
for theme, _ in themes_by_person[person]
|
| 44 |
-
|
|
|
|
| 45 |
|
| 46 |
# Case 1: Theme shared by all people
|
| 47 |
for theme, count in theme_counter.items():
|
| 48 |
if count == len(people_set):
|
|
|
|
| 49 |
return theme
|
| 50 |
# Case 2: Theme shared by most people
|
|
|
|
| 51 |
if theme_counter:
|
| 52 |
most_common_theme, _ = theme_counter.most_common(1)[0]
|
|
|
|
| 53 |
return most_common_theme
|
| 54 |
if people_by_theme:
|
| 55 |
most_popular_theme, _ = Counter({theme: len(people) for theme, people in people_by_theme.items()}).most_common(1)[0]
|
|
|
|
| 56 |
return most_popular_theme
|
| 57 |
else:
|
| 58 |
return None
|
|
|
|
| 40 |
theme_counter = Counter()
|
| 41 |
for person in people_set:
|
| 42 |
if person in themes_by_person:
|
| 43 |
+
unique_themes = set(theme for theme, _ in themes_by_person[person])
|
| 44 |
+
for theme in unique_themes:
|
| 45 |
+
theme_counter[theme] += 1
|
| 46 |
|
| 47 |
# Case 1: Theme shared by all people
|
| 48 |
for theme, count in theme_counter.items():
|
| 49 |
if count == len(people_set):
|
| 50 |
+
print("case 1: shared by all", theme)
|
| 51 |
return theme
|
| 52 |
# Case 2: Theme shared by most people
|
| 53 |
+
print('theme_counter', theme_counter)
|
| 54 |
if theme_counter:
|
| 55 |
most_common_theme, _ = theme_counter.most_common(1)[0]
|
| 56 |
+
print("case 2: shared by most", most_common_theme)
|
| 57 |
return most_common_theme
|
| 58 |
if people_by_theme:
|
| 59 |
most_popular_theme, _ = Counter({theme: len(people) for theme, people in people_by_theme.items()}).most_common(1)[0]
|
| 60 |
+
print("case 3: most_popular_theme", most_popular_theme)
|
| 61 |
return most_popular_theme
|
| 62 |
else:
|
| 63 |
return None
|
create_games/data/game_ideas.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
[
|
| 2 |
{
|
| 3 |
-
"Name": "
|
| 4 |
-
"Description": "
|
| 5 |
-
"Rationale": "This game is
|
| 6 |
}
|
| 7 |
]
|
|
|
|
| 1 |
[
|
| 2 |
{
|
| 3 |
+
"Name": "Date Night Drawing Game",
|
| 4 |
+
"Description": "Each player takes turns drawing a picture of something they would like to do on a date night. The other player must guess what the drawing is. The player who guesses correctly gets a point. The player with the most points at the end of the game wins.",
|
| 5 |
+
"Rationale": "This game is a fun and creative way for the two players to interact and get to know each other better."
|
| 6 |
}
|
| 7 |
]
|
home_view/__pycache__/ui_home.cpython-311.pyc
CHANGED
|
Binary files a/home_view/__pycache__/ui_home.cpython-311.pyc and b/home_view/__pycache__/ui_home.cpython-311.pyc differ
|
|
|
home_view/ui_home.py
CHANGED
|
@@ -37,6 +37,7 @@ def Init():
|
|
| 37 |
def SetSelected(playersCB):
|
| 38 |
global playersValues,selected,players
|
| 39 |
selected=[]
|
|
|
|
| 40 |
for check in playersCB:
|
| 41 |
selected.append(check)
|
| 42 |
for player_name, player_id in playersValues:
|
|
@@ -50,10 +51,12 @@ def PlayGame():
|
|
| 50 |
|
| 51 |
def Predict(sketch):
|
| 52 |
confidences = sk.Predict(sketch)
|
|
|
|
| 53 |
return confidences
|
| 54 |
|
| 55 |
def CreateGame():
|
| 56 |
global players,gameTitle
|
|
|
|
| 57 |
game_ideas = CreateGameForGroup(players)
|
| 58 |
#print("CreateGame():", game_ideas)
|
| 59 |
if not game_ideas is None:
|
|
|
|
| 37 |
def SetSelected(playersCB):
|
| 38 |
global playersValues,selected,players
|
| 39 |
selected=[]
|
| 40 |
+
players=[]
|
| 41 |
for check in playersCB:
|
| 42 |
selected.append(check)
|
| 43 |
for player_name, player_id in playersValues:
|
|
|
|
| 51 |
|
| 52 |
def Predict(sketch):
|
| 53 |
confidences = sk.Predict(sketch)
|
| 54 |
+
print("Predict():", confidences)
|
| 55 |
return confidences
|
| 56 |
|
| 57 |
def CreateGame():
|
| 58 |
global players,gameTitle
|
| 59 |
+
print("CreateGame():", players)
|
| 60 |
game_ideas = CreateGameForGroup(players)
|
| 61 |
#print("CreateGame():", game_ideas)
|
| 62 |
if not game_ideas is None:
|