From eceea2254467af2ab6e2fc2d0efd2464cd6abb4e Mon Sep 17 00:00:00 2001 From: Nick Walton Date: Tue, 19 Nov 2019 17:35:18 -0700 Subject: [PATCH] fixed bug --- play.py | 21 +++------------------ story/story_manager.py | 2 ++ 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/play.py b/play.py index b5039f1..98b5676 100644 --- a/play.py +++ b/play.py @@ -29,16 +29,6 @@ def instructions(): text += '\n* Finally if you want to end your game and start a new one just enter "restart" for any action. ' return text -def upload_story_to_cloud(story): - rating = input("Please rate the story quality from 1-10: ") - try: - rating_float = float(rating) - story.rating = rating_float - story.save_to_storage() - except: - pass - - def play_aidungeon_2(): save_story = input("Help improve AIDungeon by enabling story saving? (Y/n) ") @@ -58,6 +48,9 @@ def play_aidungeon_2(): while True: + if story_manager.story != None: + del story_manager.story + print("\n\n") context, prompt = select_game() console_print(instructions()) @@ -71,12 +64,8 @@ def play_aidungeon_2(): tcflush(sys.stdin, TCIFLUSH) action = input("> ") if action == "restart": - if upload_story: - upload_story_to_cloud(story_manager.story) break elif action == "quit": - if upload_story: - upload_story_to_cloud(story_manager.story) exit() if action != "" and action.lower() != "continue": @@ -98,13 +87,9 @@ def play_aidungeon_2(): if player_died(result): console_print(result + "\nGAME OVER") - if upload_story: - upload_story_to_cloud(story_manager.story) break elif player_won(result): console_print(result + "\n CONGRATS YOU WIN") - if upload_story: - upload_story_to_cloud(story_manager.story) break else: console_print(result) diff --git a/story/story_manager.py b/story/story_manager.py index 6fc6528..9c30916 100644 --- a/story/story_manager.py +++ b/story/story_manager.py @@ -31,6 +31,7 @@ class Story(): self.memory = 10 def __del__(self): + print("Before you go...") rating = input("Please rate the story quality from 1-10: ") try: rating_float = float(rating) @@ -115,6 +116,7 @@ class StoryManager(): def __init__(self, generator): self.generator = generator + self.story = None def start_new_story(self, story_prompt, context="", game_state=None, upload_story=False): block = self.generator.generate(context + story_prompt)