Computer Networking: A Top-Down Approach (7th Edition)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

Question

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()

Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Similar questions
    Recommended textbooks for you
    Text book image
    Computer Networking: A Top-Down Approach (7th Edi...
    Computer Engineering
    ISBN:9780133594140
    Author:James Kurose, Keith Ross
    Publisher:PEARSON
    Text book image
    Computer Organization and Design MIPS Edition, Fi...
    Computer Engineering
    ISBN:9780124077263
    Author:David A. Patterson, John L. Hennessy
    Publisher:Elsevier Science
    Text book image
    Network+ Guide to Networks (MindTap Course List)
    Computer Engineering
    ISBN:9781337569330
    Author:Jill West, Tamara Dean, Jean Andrews
    Publisher:Cengage Learning
    Text book image
    Concepts of Database Management
    Computer Engineering
    ISBN:9781337093422
    Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
    Publisher:Cengage Learning
    Text book image
    Prelude to Programming
    Computer Engineering
    ISBN:9780133750423
    Author:VENIT, Stewart
    Publisher:Pearson Education
    Text book image
    Sc Business Data Communications and Networking, T...
    Computer Engineering
    ISBN:9781119368830
    Author:FITZGERALD
    Publisher:WILEY