Create the logic for command processing (parsing) for each room. Use a if/elif/else structure to parse the command entered. Only handle the movement directions. For each room, after the input statement, parse the input and simply print out the result. Need to handle all the cardinal directions (North, South, East, West, Northeast, Northwest, Southeast, Southwest) and Up and Down for each room. The user needs to be able to either spell out the direction or use a standard abbreviation. For example, North and N both represent the north. If the user enters a valid direction that isn't an obvious exit print out a message, such as "You can't go that way." or "You run into a wall. Ouch!". If they pick a direction, they can go just print out "You go the direction." Have this be for each rooms for all the obvious exits.
Create the logic for command processing (parsing) for each room. Use a if/elif/else structure to parse the command entered. Only handle the movement directions.
For each room, after the input statement, parse the input and simply print out the result. Need to handle all the cardinal directions (North, South, East, West, Northeast, Northwest, Southeast, Southwest) and Up and Down for each room. The user needs to be able to either spell out the direction or use a standard abbreviation. For example, North and N both represent the north. If the user enters a valid direction that isn't an obvious exit print out a message, such as "You can't go that way." or "You run into a wall. Ouch!". If they pick a direction, they can go just print out "You go the direction."
Have this be for each rooms for all the obvious exits.
....
Here is the code that needs working with:
def mazeEntrance():
print("You're in Maze Entrance.")
print("Type 'Northeast' to go to Red Room")
print("Type 'South' to go to the Blue Room")
print("type 'Southeast' to go to the Green Room")
userInput = input("Player choice: ")
if userInput =="Northeast":
redRoom()
elif userInput =="South":
blueRoom()
elif userInput =="Southeast":
greenRoom()
def greenRoom():
print("Welcome! You're in the Green Room,")
print("You found a code.")
print(" type 'Northwest' to go to Purple Room.")
userInput = input("Player choice: ")
if userInput =="Northwest":
mazeEntrance()
def goldRoom():
print("Welcome! You're in the Gold Room.")
print("Go to the White Room and type 1234.")
print("type 'North' to go to the White Room.")
userInput = input("Player choice: ")
if userInput =="North":
whiteRoom()
def blueRoom():
print("Welcome! You're in the Blue Room.")
print("type 'South to go to White Room.")
userInput = input("Player choice: ")
if userInput =="South":
whiteRoom()
def cyanRoom():
print("Welcome! You're in the Cyan Room,")
print("type 'West' to go to the Dead End and return to Purple Room or Southeast to return to Maze Entrance")
userInput = input("Player choice: ")
if userInput =="West":
startPoint()
elif userInput =="Southeast":
mazeEntrance()
def endRoom():
print("Winner!")
def blackRoom():
print("Welcome! You're in the Black Room,")
print("type 'East' or 'South'")
userInput = input("Player choice: ")
if userInput =="East":
print("Dead End")
elif userInput =="South":
endRoom()
def violetRoom():
print("Welcome! You're in the Violet Room,")
print("type 'South' to go to the Black Room")
userInput = input("Player choice: ")
if userInput =="South":
blackRoom()
def whiteRoom():
print("Welcome! You're in the White Room,")
print("type '1234' to go to the Violet Room")
userInput = input("Player choice: ")
if userInput =="1234":
violetRoom()
else:
startPoint()
def chromaticRoom():
print("Welcome! You're in Chromatic Room,")
print("type 'West' to go to the Cyan Room")
print("type 'North' to go to the White Room")
print("type 'Code' to enter the Gold Room.")
userInput = input("Player choice: ")
if userInput =="West":
cyanRoom()
elif userInput =="North":
whiteRoom()
elif userInput =="Code":
goldRoom()
def redRoom():
print("Welcome! You're in the Red Room,")
print("type 'West' to go to the Chromatic Room.")
userInput = input("Player choice: ")
if userInput =="West":
chromaticRoom()
print("The Scary Maze is ahead. Can you escape?")
def startPoint():
print("Type 'West' to go to Maze Entrance")
userInput = input("Player choice:")
if userInput =="West":
mazeEntrance()
startPoint()
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 4 images