Question: I am new to the world of scripting and Python. Following your helpful advice here with what I already had, when I run the program,

I am new to the world of scripting and Python. Following your helpful advice here with what I already had, when I run the program, it just loops over and over saying I am currently in the Great Hall until the "Processed finished with exit code -1" shows. I cannot seem to figure out where I am going wrong. Also, it continues to let me know that my move code is unreachable.

# A dictionary for the simplified dragon text game # The dictionary links a room to other rooms import dictionary rooms = { 'Great Hall': {'South': 'Bedroom'}, 'Bedroom': {'North': 'Great Hall', 'East': 'Cellar'}, 'Cellar': {'West': 'Bedroom'} } # start player in the Great Hall starting_room = 'Great Hall' # set the current room to use within loop current_room = starting_room while True: print(" You are currently in the {}".format(current_room)) # have user enter command to move| such as 'go North', 'go South', 'go East', 'go West', or 'Exit' # split the input space, take the last portion, and capitalize first letter # if 'go Direction' ==> 'Direction' # if 'exit' ==> 'Exit' move = input("Enter 'go North/South/East/West' to move or 'Exit':").split()[-1].capitalize() # user wants to exit if move == 'Exit': current_room = 'Exit' breakpoint() # if player enters a valid move command elif move in rooms[current_room]: current_room = rooms[current_room][move] # if player enters an invalid move command else: print("Invalid Move! There is no room to the {}".format(move)) 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!