mirror of
https://github.com/wassname/Clover-Edition.git
synced 2026-09-09 11:13:26 +08:00
fixed bug
This commit is contained in:
@@ -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. '
|
text += '\n* Finally if you want to end your game and start a new one just enter "restart" for any action. '
|
||||||
return text
|
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():
|
def play_aidungeon_2():
|
||||||
|
|
||||||
save_story = input("Help improve AIDungeon by enabling story saving? (Y/n) ")
|
save_story = input("Help improve AIDungeon by enabling story saving? (Y/n) ")
|
||||||
@@ -58,6 +48,9 @@ def play_aidungeon_2():
|
|||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|
||||||
|
if story_manager.story != None:
|
||||||
|
del story_manager.story
|
||||||
|
|
||||||
print("\n\n")
|
print("\n\n")
|
||||||
context, prompt = select_game()
|
context, prompt = select_game()
|
||||||
console_print(instructions())
|
console_print(instructions())
|
||||||
@@ -71,12 +64,8 @@ def play_aidungeon_2():
|
|||||||
tcflush(sys.stdin, TCIFLUSH)
|
tcflush(sys.stdin, TCIFLUSH)
|
||||||
action = input("> ")
|
action = input("> ")
|
||||||
if action == "restart":
|
if action == "restart":
|
||||||
if upload_story:
|
|
||||||
upload_story_to_cloud(story_manager.story)
|
|
||||||
break
|
break
|
||||||
elif action == "quit":
|
elif action == "quit":
|
||||||
if upload_story:
|
|
||||||
upload_story_to_cloud(story_manager.story)
|
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
if action != "" and action.lower() != "continue":
|
if action != "" and action.lower() != "continue":
|
||||||
@@ -98,13 +87,9 @@ def play_aidungeon_2():
|
|||||||
|
|
||||||
if player_died(result):
|
if player_died(result):
|
||||||
console_print(result + "\nGAME OVER")
|
console_print(result + "\nGAME OVER")
|
||||||
if upload_story:
|
|
||||||
upload_story_to_cloud(story_manager.story)
|
|
||||||
break
|
break
|
||||||
elif player_won(result):
|
elif player_won(result):
|
||||||
console_print(result + "\n CONGRATS YOU WIN")
|
console_print(result + "\n CONGRATS YOU WIN")
|
||||||
if upload_story:
|
|
||||||
upload_story_to_cloud(story_manager.story)
|
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
console_print(result)
|
console_print(result)
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ class Story():
|
|||||||
self.memory = 10
|
self.memory = 10
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
|
print("Before you go...")
|
||||||
rating = input("Please rate the story quality from 1-10: ")
|
rating = input("Please rate the story quality from 1-10: ")
|
||||||
try:
|
try:
|
||||||
rating_float = float(rating)
|
rating_float = float(rating)
|
||||||
@@ -115,6 +116,7 @@ class StoryManager():
|
|||||||
|
|
||||||
def __init__(self, generator):
|
def __init__(self, generator):
|
||||||
self.generator = generator
|
self.generator = generator
|
||||||
|
self.story = None
|
||||||
|
|
||||||
def start_new_story(self, story_prompt, context="", game_state=None, upload_story=False):
|
def start_new_story(self, story_prompt, context="", game_state=None, upload_story=False):
|
||||||
block = self.generator.generate(context + story_prompt)
|
block = self.generator.generate(context + story_prompt)
|
||||||
|
|||||||
Reference in New Issue
Block a user