Skip to content

Instantly share code, notes, and snippets.

@Funk3
Created Oct 30, 2017
Embed
What would you like to do?
from sys import exit
def name():
print("You hear a whisper...")
print("What is your name?")
user = input("> ")
start(user)
def approve(user):
print(f"Count Doom does not approve...{user}.")
roomE(user)
def start(user):
print("You are standing in a forest... the rain bellows down on you and thunder rolls.")
print("You see flashes of lightning everywhere.. and you forgot how you got to be here...")
print("It doesn't matter you tell yourself, and you wonder what to do next...")
print(f"Watch your feet {user}, AS YOU ARE ABOUT TO FALL!")
print("You feel yourself fall into a sliding hole, and you are filled with fear as you don't know when it ends.")
print("You find yourself with sore knees as you fall into the ground.")
print(f"You hear someone say {user}.... menacingly")
roomE(user)
def roomE(user):
print("The room has completely encapsuled you in darkness.. until you see a small flame start in the centre of the room.")
print("There is nothing of note inside the room except the bare moss covered stone walls...")
print("And 4 doors made of iron and wood. You are facing north. Which room do you go into?")
choice = input("> ")
if choice == "North" or "north":
roomB(user)
elif choice == "West" or "west":
roomD(user)
elif choice == "East" or "east":
roomF(user)
elif choice == "South" or "south":
roomH(user)
else:
approve(user)
def roomB(user):
print("As you enter the room, there is a dim blue light..")
print("It makes the walls look wavy, and everything appears to be made of water.")
print("There are three doors, but something smells odd.")
print("Where do you go?")
hiddenroom = False
while True:
choice = input("> ")
if choice == "East" or "east":
roomC(user)
elif choice == "West" or "west":
roomA(user)
elif choice == "South" or "south":
roomE(user)
elif choice == "North" or "north" and not hiddenroom:
print("Count Doom laughs at you menacingly.")
print("Want to feel crazy?")
roomE(user)
elif choice == "Slap you with a trout" or "slap" or "trout" and not hiddenroom:
print("You hear a rumbling in the room.")
print("You hear a menacing whisper right inside your head.")
print("'I approve....,', Count Doom says, 'You are doing well....'")
hiddenroom = True
elif choice == "North" or "north" and hiddenroom:
print("There might be a way out of here!")
hiddenroom2(user)
else:
approve(user)
def roomC(user):
print("Hmmm")
approve(user)
def roomA(user):
print("hmmm")
approve(user)
def hiddenroom2(user):
print("Congratulations!")
name()
Copy link

ghost commented Oct 31, 2017

I believe your 'or' is the problem.
try elif choice in ['North', 'north'] and not hiddenroom

@Karakth
Copy link

Karakth commented Nov 4, 2017

You can avoid checking for capitalization by doing this to your string:

choice.lower()

https://docs.python.org/3/library/stdtypes.html#str.lower

You could also maybe make another function, a game engine you call on choice which checks the travel direction (N, S, W, E) and return it to the room method. That would avoid you having to type out all the if/elif statements in each room.

ex45: The Great Nemesis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment