From 69c5c8cb401fb5e4571b853b584bf4b997d728b3 Mon Sep 17 00:00:00 2001 From: Tucker Date: Mon, 11 Mar 2024 20:11:19 -0400 Subject: [PATCH] fix loop --- Tucker/Path game.py | 87 +++++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 42 deletions(-) diff --git a/Tucker/Path game.py b/Tucker/Path game.py index 3f003d7..d9cb998 100644 --- a/Tucker/Path game.py +++ b/Tucker/Path game.py @@ -1,47 +1,50 @@ print("You are walking down a road. There is a fork in the road one path leads to the entrance of a cave. the other leads to the enterance of a forest.") + path = input("Which way do you go? (cave/forest)") -while path != "cave" or path != "forest": - if path == "forest": - print("You decide to got to the forest enterance") - forest_chioce = input("You enter the forest and see a cub. What do you do (run/investigate)") - if forest_chioce == "run": - print("you run out of the forest returning home, safe but never knowing what happpened to the cub. THE END :( ") - elif forest_chioce == "investigate": - cub_chioce = input("you are unable to find the cubs mother. it seems to have been abandoned. What do you do? (care for it/leave it)") - while cub_chioce != "care for it" and cub_chioce != "leave it": - if cub_chioce == "care for it": - cub_name = input("you take the cub home. What will you name it?:") - print(f"you and {cub_name} live a happily ever after. THE END") +while not (path == "cave" or path == "forest"): + path = input("Which way do you go? (cave/forest)") + +if path == "forest": + print("You decide to got to the forest enterance") + forest_chioce = input("You enter the forest and see a cub. What do you do (run/investigate)") + if forest_chioce == "run": + print("you run out of the forest returning home, safe but never knowing what happpened to the cub. THE END :( ") + elif forest_chioce == "investigate": + cub_chioce = input("you are unable to find the cubs mother. it seems to have been abandoned. What do you do? (care for it/leave it)") + while cub_chioce != "care for it" and cub_chioce != "leave it": + if cub_chioce == "care for it": + cub_name = input("you take the cub home. What will you name it?:") + print(f"you and {cub_name} live a happily ever after. THE END") + exit() + elif cub_chioce == "leave it": + print("you return home out of the forest never knowing what happened to the cub. THE END") + exit() + else: + print("sorry I do not accept that option.") +elif path == "cave": + print("You decide to enter the cave") + cave_path = input("there are two tunnels left and right wich way do you go? (left/right)") + if cave_path == "left": + cave_chioce1 = input("You find a group of snakes. do you try to sneak out or play dead? (sneak out/play dead)") + while cave_chioce1 != "sneak out" or cave_chioce1 != "play dead": + if cave_chioce1 == "sneak out": + print("You try to quitly sneak out and succeed. You then run home and are greeted with safety. THE END") exit() - elif cub_chioce == "leave it": - print("you return home out of the forest never knowing what happened to the cub. THE END") + elif cave_chioce1 == "play dead": + print("You try to play dead, but the snakes notice and kill you. THE END") exit() else: - print("sorry I do not accept that option.") - elif path == "cave": - print("You decide to enter the cave") - cave_path = input("there are two tunnels left and right wich way do you go? (left/right)") - if cave_path == "left": - cave_chioce1 = input("You find a group of snakes. do you try to sneak out or play dead? (sneak out/play dead)") - while cave_chioce1 != "sneak out" or cave_chioce1 != "play dead": - if cave_chioce1 == "sneak out": - print("You try to quitly sneak out and succeed. You then run home and are greeted with safety. THE END") - exit() - elif cave_chioce1 == "play dead": - print("You try to play dead, but the snakes notice and kill you. THE END") - exit() - else: - print("I do not accept that as an option.") - elif cave_path == "right": - cave_choice2 = input("You find a group of sleeping wolves! What do you do? (Sneak out/Play dead)") - while cave_choice2 != "Sneak out" or cave_choice2 != "Play dead": - if cave_choice2 == "Sneak out": - print("You try to sneak out, but you trip over a stone! The wolves then wake up and devour you. THE END") - exit() - elif cave_choice2 != "Play dead": - print("You play dead and when the wolves wake up they don't notice you allowing you to exscape and return home to safety. THE END") - exit() - else: - print("Sorry that is not an option.") - else: - print("Sorry, but that is not a given option.") \ No newline at end of file + print("I do not accept that as an option.") + elif cave_path == "right": + cave_choice2 = input("You find a group of sleeping wolves! What do you do? (Sneak out/Play dead)") + while cave_choice2 != "Sneak out" or cave_choice2 != "Play dead": + if cave_choice2 == "Sneak out": + print("You try to sneak out, but you trip over a stone! The wolves then wake up and devour you. THE END") + exit() + elif cave_choice2 == "Play dead": + print("You play dead and when the wolves wake up they don't notice you allowing you to exscape and return home to safety. THE END") + exit() + else: + print("Sorry that is not an option.") +else: + print("Sorry, but that is not a given option.") \ No newline at end of file