Question
Solution Preview
This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.
# silver lock state variablesilver_lock = "left"
# gold lock state variable
gold_lock = "center"
# soil state variable
soil = "dry"
# string state variable
string = "floor"
# tomcat state variable
tomcat = "bedroom"
# mouse state variable
mouse = "hidden"
# carrying state variable
carrying = []
# Function to go to Entrance
def goEntrance():
global silver_lock, gold_lock
# Print room
print("\n\n")
print("Room: Entrance")
print("--------------")
print("")
# Print Entrance description
print("You're in the entrance hallway. The door that brought you in from the outside is gone.")
print()
print("In front of you there is a door that leads deeper into the house. To your left is an entranceway into the pantry. To your right is an entranceway into the kitchen.")
print()
print("Room actions")
print("1: Try to open the door")
print("2: Go through the left entryway")
print("3: Go through the right entryway")
# Get user input
choice = input("Your selection: ")
# Handle Entrance action
if choice == "1":
if silver_lock == "right" and gold_lock == "left":
return goLivingRoom()
else:
print("The door remains stubbornly locked!")
elif choice == "2":
return goPantry()
elif choice == "3":
return goKitchen()
else:
print("ERROR: "+choice+" is not a valid selection, select one of: 1,2,3")
goEntrance()
# Function to go to Pantry
def goPantry():
global silver_lock
# Print room
print("\n\n")
print("Room: Pantry")
print("--------------")
print("")
# Print Pantry description
print("You're in the pantry that contains the usual foodstuffs. In front of you is a silver lock with 3 positions: left, center and right. Behind you is the doorway to the entranceway.")
print()...