room = 1
end = False
while not end:
# start room
if room == 1:
print("Actions available: look, forward")
cmd = input("> ")
if cmd == 'look':
print("You are standing at the entrance to a long tunnel.")
elif cmd == 'forward':
room = 2
# middle room
elif room == 2:
if not end:
print("Actions available: look, forward, backward")
cmd = input("> ")
if cmd == 'look':
print("You are in the depths of the tunnel.")
elif cmd == 'forward':
room = 3
elif cmd == 'backward':
room = 1
# exit room
else:
print("You have escaped the tunnel. You win!")
end = True
Actions available: look, forward
> backward
Actions available: look, forward
> look
You are standing at the entrance to a long tunnel.
Actions available: look, forward
> forward
Actions available: look, forward, backward
> look
You are in the depths of the tunnel.
Actions available: look, forward, backward
> backward
Actions available: look, forward
> look
You are standing at the entrance to a long tunnel.
Actions available: look, forward
> forward
Actions available: look, forward, backward
> forward
You have escaped the tunnel. You win!
No comments:
Post a Comment