jonpreamble commited on
Commit
e7ea6a7
·
1 Parent(s): c7a90d5
Files changed (3) hide show
  1. app.py +18 -5
  2. decider_utils.py +3 -2
  3. game_content.py +10 -2
app.py CHANGED
@@ -3,10 +3,19 @@
3
  import os, random
4
  import openai
5
  import gradio as gr
6
- from game_content import INITIAL_WELCOME_TEXT
7
- from game_content import GAME_INTRO_CHOICES, NOTES_TO_THE_NARRATOR_AT_START, AWAITING_INPUT, NOTES_TO_THE_NARRATOR_EVERY_TIME
8
- from game_content import game_over_victory_txt, game_over_fail_txt, S_GAME_OVER
9
- from game_content import N_TURNS_REQUIRED_TO_PASS_FIRST_BANDIT_ENCOUNTER, N_TURNS_REQUIRED_TO_REACH_HOME
 
 
 
 
 
 
 
 
 
10
  import decider_utils
11
  from decider_utils import YES, NO
12
  from decider_questions import * # QUESTION_IS_USER_HOME, QUESTION_IS_USER_ENGAGED_WITH_BANDITS, etc.
@@ -93,7 +102,11 @@ def run_1_game_turn(s_narr_transcript, s_n_turns_elapsed, s_user_transcript, s_u
93
  n_turns_elapsed += 1
94
  s_user_transcript += s_user_input + "\n"
95
  s_narr_transcript += s_user_input + "\n"
96
- s_narr_transcript += NOTES_TO_THE_NARRATOR_EVERY_TIME
 
 
 
 
97
 
98
  s_new_narr_transcript = elaborate(
99
  s_narr_transcript,
 
3
  import os, random
4
  import openai
5
  import gradio as gr
6
+ from game_content import (
7
+ INITIAL_WELCOME_TEXT,
8
+ GAME_INTRO_CHOICES,
9
+ NOTES_TO_THE_NARRATOR_AT_START,
10
+ AWAITING_INPUT,
11
+ NOTES_TO_THE_NARRATOR_EVERY_TIME_AT_FIRST,
12
+ NOTES_TO_THE_NARRATOR_EVERY_TIME_IN_ENDGAME,
13
+ game_over_victory_txt,
14
+ game_over_fail_txt,
15
+ S_GAME_OVER,
16
+ N_TURNS_REQUIRED_TO_PASS_FIRST_BANDIT_ENCOUNTER,
17
+ N_TURNS_REQUIRED_TO_REACH_HOME,
18
+ )
19
  import decider_utils
20
  from decider_utils import YES, NO
21
  from decider_questions import * # QUESTION_IS_USER_HOME, QUESTION_IS_USER_ENGAGED_WITH_BANDITS, etc.
 
102
  n_turns_elapsed += 1
103
  s_user_transcript += s_user_input + "\n"
104
  s_narr_transcript += s_user_input + "\n"
105
+
106
+ if n_turns_elapsed < AFTER_N_TURNS_MAKE_IT_EASY_TO_WIN:
107
+ s_narr_transcript += NOTES_TO_THE_NARRATOR_EVERY_TIME_AT_FIRST
108
+ else:
109
+ s_narr_transcript += NOTES_TO_THE_NARRATOR_EVERY_TIME_IN_ENDGAME
110
 
111
  s_new_narr_transcript = elaborate(
112
  s_narr_transcript,
decider_utils.py CHANGED
@@ -6,6 +6,7 @@ NO = False
6
 
7
  g_decider_utils_dbg_printing = False
8
 
 
9
  def yesno(question, text, default):
10
  global g_decider_utils_dbg_printing
11
 
@@ -58,9 +59,10 @@ def special_case_is_running_away(text):
58
  else:
59
  return NO
60
 
 
61
  def special_case_is_magic(text):
62
  is_magic = False
63
- for keyword in ["magic", "spell", "fly", "invisib", "levitat", "teleport", "dragon", "genie", "fairy", "demon", "devil", "angel", "griffin", "wand"]:
64
  if keyword in text.lower():
65
  is_magic = True
66
  break
@@ -69,4 +71,3 @@ def special_case_is_magic(text):
69
  return YES
70
  else:
71
  return yesno(decider_questions.QUESTION_IS_ACTION_MAGIC, text, default=NO)
72
-
 
6
 
7
  g_decider_utils_dbg_printing = False
8
 
9
+
10
  def yesno(question, text, default):
11
  global g_decider_utils_dbg_printing
12
 
 
59
  else:
60
  return NO
61
 
62
+
63
  def special_case_is_magic(text):
64
  is_magic = False
65
+ for keyword in ["magic", "spell", "fly", "invisib", "levitat", "shapeshift", "morph", "shrink", "transform", "teleport", "dragon", "genie", "fairy", "demon", "devil", "angel", "griffin", "wand"]:
66
  if keyword in text.lower():
67
  is_magic = True
68
  break
 
71
  return YES
72
  else:
73
  return yesno(decider_questions.QUESTION_IS_ACTION_MAGIC, text, default=NO)
 
game_content.py CHANGED
@@ -406,11 +406,19 @@ ATTEMPTS TO REACH HOME MUST ALWAYS BE FOILED BY GETTING LOST, ENCOUNTERING DANGE
406
 
407
  """
408
 
409
- NOTES_TO_THE_NARRATOR_EVERY_TIME = """
410
 
411
- What happens in JUST THE NEXT THREE SECONDS?
 
 
 
 
 
 
 
 
412
  """
413
 
 
414
  AWAITING_INPUT = """Awaiting user input:
415
  """
416
 
 
406
 
407
  """
408
 
 
409
 
410
+ NOTES_TO_THE_NARRATOR_EVERY_TIME_AT_FIRST = """
411
+
412
+ What happens in JUST THE NEXT THREE SECONDS? Please keep accurate count of their diminishing number of coins.
413
+ """
414
+
415
+
416
+ NOTES_TO_THE_NARRATOR_EVERY_TIME_IN_ENDGAME = """
417
+
418
+ What happens next? Maybe the player makes it home safely to their family.
419
  """
420
 
421
+
422
  AWAITING_INPUT = """Awaiting user input:
423
  """
424