Files
2026-07-09 12:54:33 -04:00

49 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")
current_room_name = player['current_room']
result = move(current_room_name, 'north')
if isinstance(result, str):
print(result)
else:
player['current_room'] = result
look()
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