Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/adv.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from room import Room
from player import Player

# Declare all the rooms

Expand Down Expand Up @@ -49,3 +50,19 @@
# Print an error message if the movement isn't allowed.
#
# If the user enters "q", quit the game.
directions = ['n', 's', 'e', 'w']
player = Player(room['outside'])

while True:
print(player.current_room.name)
print(player.current_room.description)

user_input = input('Where would you like to go: ')

if user_input == 'q':
print('Thanks for playing!')
break
elif user_input in directions:
player.move(user_input)
else:
print("Whoops, enter a valid command like: n, s, e, w")
2 changes: 1 addition & 1 deletion src/room.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Implement a class to hold room information. This should have name and
# description attributes.
# description attributes.