Question: Python question: Winning the game! Run Terminal Save Mark Problem Solutions program.py> room = 1 end False while not end: Now we are going to

Python question:

Python question: Winning the game! Run Terminal Save Mark Problem Solutions program.py>

room = 1 end False while not end: Now we are going

to expand on our code that tracks which room the player is

Winning the game! Run Terminal Save Mark Problem Solutions program.py> room = 1 end False while not end: Now we are going to expand on our code that tracks which room the player is in so that the game ends when the player gets to the "end" room. This is our win condition and all good games have one of those! This time, to help you along a bit, we're going to give you two code snippets. The first you'll recognise from the last question it changes which room you are in if you are in the "middle" room: if room"middle": if room1: print("Actions available: forward, look") cmdinput("> ") if cmd look' print ("You are standing at the entrance to a long tunnel.") elif cmdforward' print("Actions available: forward, backward, look") action input(" ") if action"forward": room = 2 elif room 2: if not end: print("You are in the depths of the tunnel.") print("Actions available: forward, backward, look") cmdinput("> ") if cmd Look' elif cmdforward' room "end" elif action "backward" room "start" else: room 3: elif cmd'backward' room "middle" The other hint we will give you is a combination of some variables you will need to track the player's progress, and a clue about the overall structure of the program: # initialise the game room "start" Submissions Output Autosaved #14 Testing the first example in the question. Testing the second example in the question. Your submission did not produce the correct output. Your program Load Not yet! Failed a test (1 test passed). a month ago Load V # Loop while the player is not in the end room X # Check what room the player is in # Give the correct action options # Updates the room variable # Give feedback based on the room they are in output: Actions available: forward, look > look You are standing at the entrance to a long tunnel. Actions available: forward, Look forward Hint

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!