Files

47 lines
1.3 KiB
Python
Executable File

# Define Rooms
rooms = {
'start': {
'name': 'Start',
'description': "You find yourself in the dimly lit hallway. The walls are bare and you notice several doors leading to different rooms.",
'north': 'hallway'
},
'hallway': {
'name': 'Hallway',
'description': "A long corridor with no visible exits."
}
}
# Define Player State
player = {
'current_room': 'start',
'inventory': []
}
def move(current_room, direction):
return rooms[current_room][direction]
def look():
print(f"Current Room: {player['current_room']]}\n")
print(rooms[player['current_room']]['name']])
if player['current_room'] == 'hallway':
print("There are several doors leading to different rooms.")
else:
print("You see a door to the north.")
while True:
action = input("What do you want to do? Type 'look', 'move north', or 'quit' to exit: ")
if action == 'look':
look()
elif action == 'move north':
current_room_name = player['current_room']
result = move(current_room_name, 'north')
if isinstance(result, str):
print(result)
else:
player['current_room'] = result
look()
elif action == 'quit':
print("Goodbye!")
break