Kim Adams commited on
Commit
2fb862a
·
1 Parent(s): 6960ade

fixing game maker

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
@@ -129,6 +129,7 @@ def GetEnjoymentIndex(choice):
129
 
130
  def GenerateGameIdeas(themes_by_theme):
131
  print("GenerateGameIdeas, themes_by_theme:", themes_by_theme)
 
132
  # Filter themes with more than two people sharing it
133
  eligible_themes = {theme: people for theme, people in themes_by_theme.items() if len(people) > 1}
134
  print('\n****eligible themes')
@@ -165,10 +166,9 @@ def GenerateGameIdeas(themes_by_theme):
165
  try:
166
  game_data_dict = json.loads(game_data)
167
  game_ideas.append(game_data_dict)
168
- print("game_data", game_data_dict)
169
  except json.JSONDecodeError:
170
  print("Error decoding JSON. Skipping this entry.")
171
- ''' GenerateGameIdeas(themes_by_theme)'''
172
  continue
173
 
174
  # Sort the game ideas by enjoyment index in descending order
@@ -206,9 +206,13 @@ def LoadThemes():
206
  CreateThemeToPersonMapping()
207
  PrintThemesByPerson()
208
 
209
- def CreateGameForGroup(group):
 
210
  print("\n\ngroup, ", group)
211
- common_topics = FindOverlappingTopics(group)
 
 
 
212
  print("common topics: ", common_topics)
213
  print("****")
214
  print("people by theme: ", people_by_theme)
@@ -217,12 +221,12 @@ def CreateGameForGroup(group):
217
  game_ideas = GenerateGameIdeas(themes_by_person)
218
  print("game ideas: ")
219
  print(game_ideas)
220
- ''' if( game_ideas is None):
221
  print("game_ideas is None, trying again")
222
- CreateGameForGroup(players)'''
223
 
224
- if len(game_ideas) >0:
225
- print("Generated Game Idea:")
226
  print(game_ideas)
227
  gameDF=pd.DataFrame(game_ideas)
228
  return gameDF
 
129
 
130
  def GenerateGameIdeas(themes_by_theme):
131
  print("GenerateGameIdeas, themes_by_theme:", themes_by_theme)
132
+
133
  # Filter themes with more than two people sharing it
134
  eligible_themes = {theme: people for theme, people in themes_by_theme.items() if len(people) > 1}
135
  print('\n****eligible themes')
 
166
  try:
167
  game_data_dict = json.loads(game_data)
168
  game_ideas.append(game_data_dict)
169
+ print("----game_data", game_data_dict)
170
  except json.JSONDecodeError:
171
  print("Error decoding JSON. Skipping this entry.")
 
172
  continue
173
 
174
  # Sort the game ideas by enjoyment index in descending order
 
206
  CreateThemeToPersonMapping()
207
  PrintThemesByPerson()
208
 
209
+ def CreateGameForGroup(group, retry=False):
210
+ global common_topics, themes
211
  print("\n\ngroup, ", group)
212
+ if not retry:
213
+ common_topics = FindOverlappingTopics(group)
214
+ else:
215
+ common_topics = themes
216
  print("common topics: ", common_topics)
217
  print("****")
218
  print("people by theme: ", people_by_theme)
 
221
  game_ideas = GenerateGameIdeas(themes_by_person)
222
  print("game ideas: ")
223
  print(game_ideas)
224
+ if game_ideas is None:
225
  print("game_ideas is None, trying again")
226
+ CreateGameForGroup(players, True)
227
 
228
+ else:
229
+ print("***Generated Game Idea:")
230
  print(game_ideas)
231
  gameDF=pd.DataFrame(game_ideas)
232
  return gameDF
create_games/data/game_ideas.json CHANGED
@@ -1,8 +1,8 @@
1
  [
2
  {
3
- "Name": "John's Adventure",
4
- "Description": "John's Adventure is a text-based game in which the player takes on the role of John, a brave explorer. The goal of the game is to explore the world, discover new lands, and complete various quests. The player must use their wits and skills to overcome obstacles and progress through the game. The game features a variety of puzzles, enemies, and items to collect. The game also features an inventory system and a leveling system.",
5
- "EnjoymentIndex": "0.8",
6
- "Rationale": "John's Adventure is a classic text-based game that offers a great deal of exploration and puzzle-solving. It also features a variety of items to collect and enemies to defeat, which adds to the game's replayability. The inventory and leveling systems also add an extra layer of depth to the game, making it more enjoyable for players."
7
  }
8
  ]
 
1
  [
2
  {
3
+ "Name": "Food Fight",
4
+ "Description": "Players take turns selecting food items and trying to guess what their opponents have chosen. If they guess correctly, they win the round. The first player to win 3 rounds wins the game.",
5
+ "EnjoymentIndex": "0.7",
6
+ "Rationale": "This game is easy to learn and provides a fun challenge for players to guess what their opponents have chosen."
7
  }
8
  ]
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
@@ -45,10 +45,11 @@ def Predict(sketch):
45
  def CreateGame():
46
  global players,gameTitle
47
  game_ideas = CreateGameForGroup(players)
48
- if not game_ideas.empty:
 
49
  game_ideas_dict = game_ideas.to_dict('records')
50
  return game_ideas, game_ideas_dict[0]['Description'],game_ideas_dict[0]['Name']
51
- return None,"No game"
52
 
53
  df1 =gr.Dataframe(type="pandas", value=startDF)
54
  df2 =gr.Dataframe(type="pandas", value=slackDF)
@@ -63,7 +64,7 @@ with gr.Blocks() as ui:
63
  playersCB = gr.CheckboxGroup ([], label="Players", info="Pick some players for the game!" )
64
  createBtn = gr.Button(value="Create Game", variant="primary")
65
  gameTitle=gr.Markdown("Game Title", container=False)
66
- desc=gr.TextArea(info="Game Description", interactive=False, show_label=False, container=False,
67
  placeholder="Your game description will show here", lines=3)
68
  playBtn = gr.Button(value="Let's Play", variant="primary")
69
  with gr.Row(visible=False) as holder:
@@ -73,7 +74,6 @@ with gr.Blocks() as ui:
73
  label=gr.Label()
74
  sketch.change(Predict, inputs=[sketch], outputs=[label])
75
 
76
-
77
  with gr.Blocks() as dfs:
78
  startBtn=gr.Button(value="BuildPlay", variant="primary")
79
  gr.TabbedInterface([df1,df2,df3,df4], ("Start", "Slack","Embeddings","Games"))
 
45
  def CreateGame():
46
  global players,gameTitle
47
  game_ideas = CreateGameForGroup(players)
48
+ print("CreateGame:", game_ideas)
49
+ if not game_ideas is None:
50
  game_ideas_dict = game_ideas.to_dict('records')
51
  return game_ideas, game_ideas_dict[0]['Description'],game_ideas_dict[0]['Name']
52
+ return None,"No game", "No game"
53
 
54
  df1 =gr.Dataframe(type="pandas", value=startDF)
55
  df2 =gr.Dataframe(type="pandas", value=slackDF)
 
64
  playersCB = gr.CheckboxGroup ([], label="Players", info="Pick some players for the game!" )
65
  createBtn = gr.Button(value="Create Game", variant="primary")
66
  gameTitle=gr.Markdown("Game Title", container=False)
67
+ desc=gr.TextArea(info="Game Description", interactive=False, show_label=False,
68
  placeholder="Your game description will show here", lines=3)
69
  playBtn = gr.Button(value="Let's Play", variant="primary")
70
  with gr.Row(visible=False) as holder:
 
74
  label=gr.Label()
75
  sketch.change(Predict, inputs=[sketch], outputs=[label])
76
 
 
77
  with gr.Blocks() as dfs:
78
  startBtn=gr.Button(value="BuildPlay", variant="primary")
79
  gr.TabbedInterface([df1,df2,df3,df4], ("Start", "Slack","Embeddings","Games"))
slack_processing/__pycache__/theme.cpython-311.pyc CHANGED
Binary files a/slack_processing/__pycache__/theme.cpython-311.pyc and b/slack_processing/__pycache__/theme.cpython-311.pyc differ
 
slack_processing/theme.py CHANGED
@@ -6,7 +6,6 @@ class Theme:
6
  self.message=message
7
  self.person=person
8
  self.postId=postId
9
- #self.topReaction=topReaction
10
  self.themeSimilarity=similarity
11
 
12
  def to_dict(self):
@@ -17,6 +16,5 @@ class Theme:
17
  'message': self.message,
18
  'person': self.person,
19
  'postId': self.postId,
20
- #'topReaction': self.topReaction,
21
  'themeSimilarity': self.themeSimilarity
22
  }
 
6
  self.message=message
7
  self.person=person
8
  self.postId=postId
 
9
  self.themeSimilarity=similarity
10
 
11
  def to_dict(self):
 
16
  'message': self.message,
17
  'person': self.person,
18
  'postId': self.postId,
 
19
  'themeSimilarity': self.themeSimilarity
20
  }