Kim Adams commited on
Commit
eb9e44f
·
1 Parent(s): 3b46464

logic to change up game themes vs picking first

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
@@ -1,6 +1,7 @@
1
  import pandas as pd
2
  import openai, json
3
  from collections import Counter
 
4
 
5
  INPUT_DATAPATH = "slack_processing/data/themes.json"
6
  OUTPUT_GAME_IDEAS_DATAPATH="create_games/data/game_ideas.json"
@@ -49,12 +50,23 @@ def FindCommonTheme(people_set):
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)
 
1
  import pandas as pd
2
  import openai, json
3
  from collections import Counter
4
+ from random import choice
5
 
6
  INPUT_DATAPATH = "slack_processing/data/themes.json"
7
  OUTPUT_GAME_IDEAS_DATAPATH="create_games/data/game_ideas.json"
 
50
  if count == len(people_set):
51
  print("case 1: shared by all", theme)
52
  return theme
53
+
54
  # Case 2: Theme shared by most people
55
  print('theme_counter', theme_counter)
56
  if theme_counter:
57
+ # Find the highest frequency among themes
58
+ max_count = theme_counter.most_common(1)[0][1]
59
+
60
+ # Gather all themes with that frequency
61
+ most_common_themes = [theme for theme, count in theme_counter.items() if count == max_count]
62
+
63
+ # Randomly choose among them
64
+ most_common_theme = choice(most_common_themes)
65
+
66
  print("case 2: shared by most", most_common_theme)
67
  return most_common_theme
68
+
69
+ # Case 3: Most popular theme
70
  if people_by_theme:
71
  most_popular_theme, _ = Counter({theme: len(people) for theme, people in people_by_theme.items()}).most_common(1)[0]
72
  print("case 3: most_popular_theme", most_popular_theme)
create_games/data/game_ideas.json CHANGED
@@ -1,7 +1,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
  ]
 
1
  [
2
  {
3
+ "Name": "Identity Drawing Game",
4
+ "Description": "Each player takes turns drawing a picture that represents their identity. The other players must guess what the drawing is about. The player who guesses correctly earns a point. The player with the most points at the end of the game wins.",
5
+ "Rationale": "This game encourages players to think about their identity and how they can express it through art. It also encourages creativity and communication between players."
6
  }
7
  ]