This commit is contained in:
Nick
2019-10-29 14:04:47 -06:00
parent 3c1215f69c
commit 2c47e32d9f
2 changed files with 4 additions and 27 deletions
-2
View File
@@ -50,8 +50,6 @@ def play_constrained():
story_manager = ConstrainedStoryManager(generator)
story_manager.start_new_story(prompt, context=context)
console_print("\n")
console_print(str(story_manager.story))
possible_actions = story_manager.get_possible_actions()
while (True):
console_print("\nOptions:")
+4 -25
View File
@@ -207,35 +207,14 @@ class ConstrainedStoryManager(StoryManager):
class CTRLStoryManager(ConstrainedStoryManager):
def __init__(self, generator, action_verbs_key="anything"):
super().__init__(generator, action_verbs_key)
def start_new_story(self, story_prompt, game_state=None):
game_state = {"current_room": "lobby"}
super().start_new_story(story_prompt, game_state=game_state)
return self.story.story_start
def get_constrained_movement_options(self):
options = {}
options["word_whitelist"] = dict()
options["word_whitelist"][0] = get_ctrl_verbs("movement")
options["word_whitelist"][1] = ["to"]
options["word_whitelist"][2] = ["the"]
options["word_whitelist"][3] = \
[room for room in get_rooms("haunted_hospital") if room is not self.story.game_state["current_room"]]
options["word_whitelist"][4] = ["and"]
options["word_whitelist"][5] = ["see"]
return options, 3
def get_action_results_generate(self):
results = []
options, location_pos = self.get_constrained_movement_options()
options = {}
for phrase in self.action_phrases:
result = self.generate_action_result(self.story_context(), phrase, options=options)
location = result[0].split()[location_pos+1]
options["word_whitelist"][location_pos].remove(location)
action_verb = result[0].split()
print("blacklisted verb is ", action_verb)
options["word_blacklist"].append(action_verb)
results.append(result)
return results