I am trying to move between rooms using a dict and I can navigate if the room only has 1 location to move to but when it has more than one I get an error.
# The dictionary links a room to other rooms.
rooms = {
'Great Hall': {'South': 'Bedroom'},
'Bedroom': {'North': 'Great Hall', 'East': 'Cellar'},
'Cellar': {'West': 'Bedroom'}
}
def instructions():
print("Milestone for Module 6.")
print("Type 'go' and then the direction want to move in lowercase")
print("You can type exit to leave the game after this menu")
current_room = 'Great Hall'
direction = ''
while True:
print('\nYou are in:', current_room)
direction = input('Move which direction?')
print('You entered:', direction)
if direction == 'quit':
print('Game Exited')
break
elif direction == 'go north':
if 'North' in rooms[current_room].keys():
current_room = str(*rooms[current_room].values())
else:
print('Unable to move to that location, try again.')
elif direction == 'go south':
if 'South' in rooms[current_room].keys():
current_room = str(*rooms[current_room].values())
else:
print('Unable to move to that location, try again.')
elif direction == 'go east':
if 'East' in rooms[current_room].keys():
current_room = str(*rooms[current_room].values())
else:
print('Unable to move to that location, try again.')
elif direction == 'go west':
if 'West' in rooms[current_room].keys():
current_room = str(*rooms[current_room].values())
else:
print('Unable to move to that location, try again.')
else:
print('Invalid, please try again.')
Would like to resolve this error and move rooms correctly.
Traceback (most recent call last):
line 40, in <module>
current_room = str(*rooms[current_room].values())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: decoding str is not supported
When you use str(*rooms[current_room].values()) and if it has more than one value in the dictionary, it will result in a TypeError. So, you should be store the values in the dict and use index to access a particular room, like this:
.
.
elif direction == 'go north':
if 'North' in rooms[current_room].keys():
current_room = rooms[current_room]['North']
else:
print('Unable to move to that location, try again.')
Related
I am currently working on a text based game for a school project. My only issue is that I cannot get my program to print 'Invalid input' when the user input does not include 'Take' and [item name]. So the item is added to inventory as long as the user input is 'Take'.
`
import sys
def start_menu():
# Print start menu and commands
print('<>' * 50) # Print lines to separate text
title = (r"""
╔═╗┬─┐┌─┐┌─┐┌┬┐ ╔═╗┬ ┬┬─┐┌─┐┌┬┐┬┌┬┐ ┌─┐┌─┐ ╔╦╗┌─┐┌─┐┬─┐┌─┐┌─┐┌┐┌
║ ╦├┬┘├┤ ├─┤ │ ╠═╝└┬┘├┬┘├─┤││││ ││ │ │├┤ ║║║├┤ ├┤ ├┬┘├┤ ├┤ │││
╚═╝┴└─└─┘┴ ┴ ┴ ╩ ┴ ┴└─┴ ┴┴ ┴┴─┴┘ └─┘└ ╩ ╩└─┘└─┘┴└─└─┘└─┘┘└┘
""")
print(title)
print('<>' * 50 ) # Print lines to separate text
print('You are a Spy visiting the Great Pyramid of Meereen. You must make your way from the top of the\n'
'Pyramid to the Dragon Pit. Collect all of the items along the way to help defeat the two Dragons.\n'
'If you are successful you will put an end to Queen Daenerys reign and save the Seven Kingdoms.\n'
'\nHappy Adventuring!')
print('<>' * 50)
print('Input move: North, South, East or West')
print('Input "Take [item name]" to add item to inventory')
print('Input "Exit" to quit game')
print('<>' * 50)
start_menu()
# Dictionary of rooms and items
rooms = {
'Terrace': {'East': 'Daenerys Chambers'},
'Daenerys Chambers': {'West': 'Terrace', 'East': 'Barristan\'s Chambers', 'South': 'Royal Chambers',
'item': 'Dragon Necklace'},
'Barristan\'s Chambers': {'West': 'Daenerys Chambers', 'item': 'Barristan\'s Sword'},
'Royal Chambers': {'North': 'Daenerys Chambers', 'South': 'Torture Cells',
'West': 'Audience Chamber', 'East': 'Stables', 'item': 'Milk of the Poppy'},
'Audience Chamber': {'East': 'Royal Chambers', 'item': 'Torch'},
'Stables': {'West': 'Royal Chambers', 'item': 'Health Potion'},
'Torture Cells': {'North': 'Royal Chambers', 'East': 'Dragon Pit', 'item': 'Magic Potion'},
'Dragon Pit': {'West': 'Torture Cells', 'Item': 'Dragons'}
}
def gameplay_loop():
move_direction = ['North', 'South', 'East', 'West']
inventory = []
current_room = 'Terrace'
# Gameplay loop
while True:
# Display Inventory
print('Inventory', inventory, '\n')
# Shows current location and item
if current_room == 'Terrace':
print('You are on the {}.\n'.format(current_room))
if current_room == 'Daenerys Chambers' or current_room == 'Barristan\'s Chambers':
print('You are in {}.'.format(current_room))
if item not in inventory:
print('Item:', item, '\n')
else:
print('You have collected all of the items in this room.\n')
elif current_room != 'Terrace':
print('You are in the {}.'.format(current_room))
if current_room == 'Torture Cells':
print('A sign reads: "Beware of Dragon Pit: East"')
if item not in inventory:
print('Item:', item, '\n')
else:
print('You have collected all of the items in this room.\n')
# Display user input
user_input = input('Enter your move:' + '\n' + '> ') # Movement control
print('') # Space for visual formatting
user_input = user_input.capitalize() # Capitalize user input to match dictionary
print('<>' * 50)
if user_input in move_direction:
user_input = user_input
if user_input in rooms[current_room].keys():
current_room = rooms[current_room][user_input]
print(current_room)
print('<>' * 50)
else:
# for invalid movement
print('You can\'t go there!')
print('<>' * 50)
# Check for exit command
elif user_input == 'Exit':
print('Thank you for playing!')
print('<>' * 50)
break
# invalid command
elif 'Take' not in user_input:
print('Invalid input\n')
if current_room != 'Terrace' and current_room != 'Dragon Pit':
item = rooms[current_room]['item']
# Update inventory
if 'Take' in user_input and current_room != 'Terrace' and item not in inventory:
inventory.append(item)
print('You found:', item)
print('<>' * 50)
if current_room == 'Terrace' and 'Take' in user_input:
print('There is no item here!')
print('<>' * 50)
# Game over
if len(inventory) == 6 and current_room == 'Dragon Pit':
print('\nYou have defeated the Dragons and saved the Seven Kingdoms!')
print('Thanks for playing!')
restart_game()
elif len(inventory) < 6 and current_room == 'Dragon Pit':
print('\nYou died.')
print('Collect all six items before facing the Dragons...')
restart_game()
def restart_game():
# Restart or exit game
restart = input('Play again? (y,n):\n> ')
if restart == 'y':
start_menu()
gameplay_loop()
if restart == 'n':
print('Goodbye.')
sys.exit()
else:
print('Invalid input')
restart_game()
gameplay_loop()
`
I tried adding this to my code but it still just accepts 'Take' for user input.
`
# invalid command
elif ('Take'+item) not in user_input:
print('Invalid input\n')
`
This operates the way you expect. I've made several changes in the organization here. I have removed all of your "automatic capitalization", so you must type the command exactly. I have removed all of your recursive calls and replaced them with loops -- this is not a proper use of recursion.
I also deleted your block title because I didn't want to deal with the character set. You can add that back in.
import sys
def start_menu():
# Print start menu and commands
print('<>' * 50)
print('You are a Spy visiting the Great Pyramid of Meereen. You must make your way from the top of the\n'
'Pyramid to the Dragon Pit. Collect all of the items along the way to help defeat the two Dragons.\n'
'If you are successful you will put an end to Queen Daenerys reign and save the Seven Kingdoms.\n'
'\nHappy Adventuring!')
print('<>' * 50)
print('Input move: North, South, East or West')
print('Input "Take [item name]" to add item to inventory')
print('Input "Exit" to quit game')
print('<>' * 50)
# Dictionary of rooms and items
rooms = {
'Terrace': {'East': 'Daenerys Chambers'},
'Daenerys Chambers': {'West': 'Terrace', 'East': 'Barristan\'s Chambers', 'South': 'Royal Chambers',
'item': 'Dragon Necklace'},
'Barristan\'s Chambers': {'West': 'Daenerys Chambers', 'item': 'Barristan\'s Sword'},
'Royal Chambers': {'North': 'Daenerys Chambers', 'South': 'Torture Cells',
'West': 'Audience Chamber', 'East': 'Stables', 'item': 'Milk of the Poppy'},
'Audience Chamber': {'East': 'Royal Chambers', 'item': 'Torch'},
'Stables': {'West': 'Royal Chambers', 'item': 'Health Potion'},
'Torture Cells': {'North': 'Royal Chambers', 'East': 'Dragon Pit', 'item': 'Magic Potion'},
'Dragon Pit': {'West': 'Torture Cells', 'Item': 'Dragons'}
}
def gameplay_loop():
move_direction = ['North', 'South', 'East', 'West']
inventory = []
current_room = 'Terrace'
# Gameplay loop
while True:
# Display Inventory
print('Inventory', inventory, '\n')
if current_room == 'Terrace':
print('You are on the {}.\n'.format(current_room))
else:
print('You are in the {}.'.format(current_room))
if current_room == 'Torture Cells':
print('A sign reads: "Beware of Dragon Pit: East"')
item = None
if 'item' in rooms[current_room]:
item = rooms[current_room]['item']
if item in inventory:
print('You have collected all of the items in this room.\n')
item = None
else:
print('Item:', item, '\n')
# Display user input
user_input = input('Enter your move:' + '\n' + '> ') # Movement control
print('') # Space for visual formatting
# user_input = user_input.title() # Capitalize each word
print('<>' * 50)
if user_input in move_direction:
user_input = user_input
if user_input in rooms[current_room].keys():
current_room = rooms[current_room][user_input]
print(current_room)
print('<>' * 50)
else:
# for invalid movement
print('You can\'t go there!')
print('<>' * 50)
continue
# Check for exit command
elif user_input == 'Exit':
print('Thank you for playing!')
print('<>' * 50)
break
# invalid command
elif 'Take' not in user_input:
print('Invalid input\n')
continue
# What item did they want?
want = user_input[5:]
if want != item:
print("That item is not available.")
continue
# Update inventory
if current_room != 'Terrace' and item not in inventory:
inventory.append(item)
print('You found:', item)
print('<>' * 50)
# Check for game over
if len(inventory) == 6 and current_room == 'Dragon Pit':
print('\nYou have defeated the Dragons and saved the Seven Kingdoms!')
print('Thanks for playing!')
elif len(inventory) < 6 and current_room == 'Dragon Pit':
print('\nYou died.')
print('Collect all six items before facing the Dragons...')
while True:
# Restart or exit game
restart = input('Play again? (y,n):\n> ')
if restart == 'y':
start_menu()
return True
if restart == 'n':
print('Goodbye.')
return False
print('Invalid input')
start_menu()
while gameplay_loop():
pass
To validate Take + Items, you need to read input and store them somthing like below if i understand correctly .
# Check for Take in input and Item name
elif 'Take' in user_input:
item = user_input[5:]
if item in rooms[current_room].values():
inventory.append(item)
print('You have added {} to your inventory.'.format(item))
print('<>' * 50)
else:
print('You can\'t take that!')
print('<>' * 50)```
So I am trying to design a text based adventure game for one of my classes. I have the movement from room to room down, but have been struggling when it comes to getting items added to the inventory for the escape. At first when I tried to enter "get 'item'" I was prompted with 'invalid move' which was happening because there was an issue with the sequence I was calling my functions. Now that I have everything fixed, the items are automatically being added to the inventory without the user entering the get item function, and every time you enter a room, the item is being added despite it already being in the inventory. Here is my code:
def show_instructions():
print('Escape From Work Text Based Game')
print('Movement commands: South, North, East, West')
print("To pick up an item, type 'get [item]'")
print()
print('Your boss is asking you to come in on your days off. To escape without being seen, you will need to get your'
' vest, backpack, lunchbox, paycheck, name badge, and car keys.')
print('Do not enter the room that has your boss, or you can kiss your days off goodbye!')
def player_stat(current_room, inventory):
print('----------------------')
print('You are in the {}'.format(current_room))
print('Item in this room: {}'.format(rooms[current_room]['Item']))
print('Inventory: ', inventory)
print('----------------------')
def move(direction, current_room, rooms):
if direction in rooms[current_room]:
current_room = rooms[current_room][direction]
else:
print('You run into the wall, customers are staring. Try again.')
return current_room
rooms = {
'Garden Center': {'South': 'Hardware Dept.', 'West': 'Customer Service', 'North': 'HR Office',
'East': 'Storage Room', 'Item': 'None'},
'Customer Service': {'East': 'Garden Center', 'Item': 'lunchbox'},
'Hardware Dept.': {'East': 'Break Room', 'North': 'Garden Center', 'Item': 'backpack'},
'HR Office': {'East': 'Lounge', 'South': 'Garden Center', 'Item': 'paycheck'},
'Lounge': {'West': 'HR Office', 'Item': 'name badge'},
'Break Room': {'West': 'Hardware Dept.'},
'Storage Room': {'West': 'Garden Center', 'North': 'Admin Office', 'Item': 'vest'},
'Admin Office': {'South': 'Storage Room', 'Item': 'keys'}
}
directions = ['North', 'East', 'South', 'West']
current_room = 'Garden Center'
inventory = []
show_instructions()
while current_room != 'Exit':
player_stat(current_room, inventory)
player_move = input('What is your command?: ').lower().title()
if player_move == 'exit':
current_room = 'Exit'
print('Sorry to see you go, play again soon!')
elif player_move in directions:
current_room = move(player_move, current_room, rooms)
item = rooms[current_room].get('Item')
if item is not None and player_move == 'get ' + item:
if item in inventory:
print('You already have this item in your inventory!')
else:
inventory.append(item)
if current_room == 'Break Room':
print('Oh no! You got caught. Have fun working this weekend.')
exit()
else:
print('Invalid move')
And this is what the output looks like after I have moved from a few of the rooms. I don't understand why it is printing invalid move after every move even if it is valid either.
You are in the HR Office
Item in this room: paycheck
Inventory: ['paycheck', 'paycheck']
----------------------
Where would you like to go?: south
Invalid move
----------------------
You are in the Garden Center
Item in this room: None
Inventory: ['paycheck', 'paycheck', 'None']
----------------------
Where would you like to go?: south
Invalid move
----------------------
You are in the Hardware Dept.
Item in this room: backpack
Inventory: ['paycheck', 'paycheck', 'None', 'backpack']
----------------------
I also still have to add a way to exit the game when you win after collecting all 6 items, and i was heading in the direction of 'if inventory == [ all 6 items in list ]: print( you win) followed by exit' Any help anyone has to offer would be greatly appreciated.
Try
#Loop continues if user has not entered 'exit' or inventory is not up to 6 items
while current_room != 'Exit' and len(inventory)!= 6:
player_stat(current_room, inventory)
player_move = input('What is your command?: ').lower().title()
if player_move == 'Exit':
current_room = 'Exit'
print('Sorry to see you go, play again soon!')
exit()
elif player_move in directions:
current_room = move(player_move, current_room, rooms)
item = rooms[current_room].get('Item')
#As the input has .title() this condition will accept input of item in that format
if item is not None and player_move == 'Get ' + item.title():
if item in inventory:
print('You already have this item in your inventory!')
#Was adding repeat items because of prior incorrect indentation
#Correct indentation with the else applying after checking inventory
else:
inventory.append(item)
if current_room == 'Break Room':
print('Oh no! You got caught. Have fun working this weekend.')
exit()
#Replaced the 'else' statement with this so the console doesn't return 'Invalid move' every time
if "get " + item not in player_move and player_move not in directions:
print('Invalid move')
#When loop breaks, user will have won
print("You won!")
Your indentation is wrong. You have this:
if item is not None and player_move == 'get ' + item:
if item in inventory:
print('You already have this item in your inventory!')
else:
inventory.append(item)
but I think you want this:
if item is not None and player_move == 'get ' + item:
if item in inventory:
print('You already have this item in your inventory!')
else:
inventory.append(item)
I'm working on a text based game in python and everything seems to be working except for the area which the player will travel to and collect items in. When I start the game, it goes through the intro (which I left out) and then shows me this error along with the player's stats:
item = player(location)
enter code hereline 59, in player
return area[location]['item']
NameError: name 'area' is not defined
I don't really understand how to fix it, I've been trying to define area but I'm still getting the same error.
def rules():
print(' \n Using the commands, North, South, East and West to navigate through the warehouse.')
print('Find your Tiramisu cake! Search the rooms of the warehouse to get your cake!')
print('........Or use Exit to leave the game.')
area = {
'Warehouse': {
'South': 'Basement', 'North': 'Storage Room', 'East': 'Parking Lot', 'West': 'Dusty Room'
},
'Parking Lot': {'West': 'Warehouse','item': 'key'},
'Basement': {'North': 'Warehouse', 'item': 'Kingpin'},
'Storage Room': {'South': 'Warehouse', 'item' : 'Tiramisu Cake'},
'Dusty Room': {'East': 'Warehouse', 'item': 'Safe' }
}
location = 'Warehouse'
def fetch(location, new_dir):
new_room = location
for i in area:
if i == location:
if new_dir in area [i]:
new_room = area [i][new_dir]
return new_room
def stats(location):
return area[location]['item']
rules()
pockets = []
#loop starts here
while 1:
print('\n***********************************************')
print('You are in the', location)
print('In your pockets you hold', pockets)
print('***********************************************')
item = area[location].get('item')
print('In this room you see', 'item')
if item == 'Kingpin':
print ('Oh no! The Kingpin!!......He pummels you, Game Over')
exit(0)
if item is not None and new_dir == 'You got ' + item:
if item in pockets:
print('This room seems empty.....oh wait you already got that item')
else:
pockets.append
new_dir = input('\n Which direction are you going?: ')
new_dir = new_dir.capitalize
if (new_dir == 'Exit'):
print('Thanks for playing!')
exit(0)
if new_dir == 'North' or new_dir == 'South' or new_dir == 'East' or new_dir == 'West':
new_room = fetch(location, new_dir)
if new_room == location:
print(' \n Invalid move, try another direction.')
else:
location = new_room
if new_dir ==str('get'+ 'item'):
if 'item' in pockets:
print('You found', 'item', '!')
pockets.append(area[location]['item'])
else:
print('Invalid move')
if len(pockets) ==3:
print('You have got what you came for, you win! Thanks for playing!')
exit(0)
break
You haven't passed area to the fecth() and stats() functions.
Either pass it or make it global
The code I have is as follows:
rooms = {
'Great Hall': {'South': 'Bedroom'},
'Bedroom': {'North': 'Great Hall', 'East': 'Cellar'},
'Cellar': {'West': 'Bedroom'}
}
def show_instructions():
print('The instructions are as follows: go north, go south, go east, go west')
def move_rooms(direction, room='Great Hall'):
if direction == 'go south':
room = 'Bedroom'
return rooms[room]['South']
elif direction == 'go north':
if room == 'Great Hall' or 'Cellar':
return 'Invalid direction please try again.'
return rooms[room]['North']
elif direction == 'go east':
if room == 'Great Hall' or 'Cellar':
return 'Invalid direction please try again.'
return rooms[room]['East']
elif direction == 'go west':
if room == 'Bedroom' or 'Great Hall':
return 'Invalid direction please try again.'
return rooms[room]['West']
currentRoom = 'Great Hall'
gameInstructions = 'The instructions are as follows: go north, go south, go east, go west'
print(gameInstructions)
print(currentRoom)
userDirection = ''
while userDirection != 'exit':
userDirection = input("Pick a direction, or type exit to exit the game.")
if currentRoom == 'Great Hall':
if userDirection == 'go south':
currentRoom = move_rooms(userDirection, currentRoom)
show_instructions()
print(currentRoom)
else:
print('Invalid direction. Please pick another direction.')
print(currentRoom)
show_instructions()
elif currentRoom == 'Bedroom':
if userDirection != 'go north' or 'go east':
print('Invalid direction. Please pick another direction.')
print(currentRoom)
show_instructions()
elif userDirection == 'go north':
currentRoom = move_rooms(userDirection, currentRoom)
print(currentRoom)
show_instructions()
elif userDirection == 'go east':
currentRoom = move_rooms(userDirection, currentRoom)
print(currentRoom)
show_instructions()
elif 'Cellar' == currentRoom:
if userDirection != 'go west':
print('Invalid direction. Please pick another direction.')
print(currentRoom)
show_instructions()
else:
currentRoom = move_rooms(userDirection, currentRoom)
print(currentRoom)
show_instructions()
else:
if userDirection == 'exit':
print('Thanks for playing the game!')
break
This is a small part of a larger text based game that I am supposed to develop as part of my college class. The goal of this program is to get user input to move between rooms. I used the template dictionary given and am trying to restrict inputs to the instruction list with the exception of the word 'exit'. So the major issue I am having is how to use the return function properly in the function I created to yield the correct result.
It is giving me a 'KeyError' of 'South' in the console everytime I try to input go south as the first direction. Any help would be appreciated.
Well, to answer your main question of why you are seeing that KeyError, is because you are trying to access a key that doesn't exist for the nested dictionary value of 'Bedroom'. Look at the k-v pair you made for that key.
You would have to do this instead to return the value for 'South' key:
if direction == 'go south':
room = 'Greathall'
return rooms[room]['South']
>>> 'Bedroom'
Just a tip here: why not call the room directly in the dictionary value extraction so instead of defining room as 'Greathall', you could do:
return rooms['Greathall']['South']
Which will give you the same response.
I need help with a text-based python game, I have done most of the work, I can move between all 3 rooms, there is 'Great hall' at the top then go south 'Bedroom' go east 'Cellar' the I can go back so go west 'bedroom' go north finally to get back to the great hall.
the problem is if I'm in the great hall and type east it skips to cellar instead of saying invalid move there's a wall.
what I'm trying to do
Output that displays the room the player is currently in.
Decision branching that tells the game how to handle the different commands. The commands can be to either move between rooms (such as go North, South, East, or West) or exit.
If the player enters a valid “move” command, the game should use the dictionary to move them into the new room.
If the player enters “exit,” the game should set their room to a room called “exit.”
If the player enters an invalid command, the game should output an error message to the player (input validation).
A way to end the gameplay loop once the player is in the “exit” room
this is the code I have written so far
rooms = {
'Great Hall': {'South': 'Bedroom'},
'Bedroom': {'North': 'Great Hall', 'East': 'Cellar'},
'Cellar': {'West': 'Bedroom'}
}
def player_stat():
print("-" * 20)
print('You are in the {}'.format(currentRoom))
print("-" * 20)
currentRoom = 'Great Hall'
player_move = ''
while currentRoom != 'Exit':
player_stat()
player_move = input('Enter your move:\n')
if player_move in ['Exit', 'exit']:
currentRoom = 'Exit'
print('Play again soon')
elif player_move in ['South', "south"]:
currentRoom = 'Bedroom'
elif player_move in ['North', "north"]:
currentRoom = 'Great Hall'
print("You made it back to the Great Hall")
elif player_move in ['East', 'east']:
currentRoom = 'Cellar'
print('YOU MADE IT TO THE CELLAR, try to go back to the Great Hall')
elif player_move in ['West', "west"]:
currentRoom = 'Bedroom'
print("You made it back to the Bedroom")
Please help me
rooms = {
'Great Hall': {'south': 'Bedroom'},
'Bedroom': {'north': 'Great Hall', 'east': 'Cellar'},
'Cellar': {'west': 'Bedroom'}
}
def player_stat():
print("-" * 20)
print('You are in the {}'.format(currentRoom))
print("-" * 20)
currentRoom = 'Great Hall'
player_move = ''
while currentRoom != 'Exit':
player_stat()
player_move = input('Enter your move:\n').lower()
if player_move in ['Exit', 'exit']:
currentRoom = 'Exit'
print('Play again soon')
continue
try:
currentRoom = rooms[currentRoom][player_move]
except Exception:
print("invalid move")
continue
if currentRoom == 'Great Hall':
print("You made it back to the Great Hall")
elif currentRoom == 'Cellar':
print('YOU MADE IT TO THE CELLAR, try to go back to the Great Hall')
print("You made it back to the Bedroom")
I modified your code to utilize the dictionary. It involves nested conditional statements.
rooms = {
'Great Hall': {'South': 'Bedroom'},
'Bedroom': {'North': 'Great Hall', 'East': 'Cellar'},
'Cellar': {'West': 'Bedroom'}
}
def player_stat():
print("-" * 20)
print('You are in the {}'.format(currentRoom))
print("-" * 20)
currentRoom = 'Great Hall'
player_move = ''
while currentRoom != 'Exit':
player_stat()
player_move = input('Enter your move:\n').title()
if player_move == 'Exit':
currentRoom = 'Exit'
else:
if player_move in rooms[currentRoom]:
currentRoom = rooms[currentRoom][player_move]
if currentRoom == 'Great Hall':
print("You made it back to the Great Hall")
elif currentRoom == 'Cellar':
print('YOU MADE IT TO THE CELLAR, try to go back to the Great Hall')
else:
print("That is not a valid move, try again.")
print('Play again soon')