Question: Python (pycharm) In Project One, you designed pseudocode or flowcharts for the two main actions in the game: moving between rooms and gathering items. In

Python (pycharm) In Project One, you designed pseudocode or flowcharts for the two main actions in the game: moving between rooms and gathering items. In this project, you will write the code for the full game based on your designs. You will also need to include some additional components beyond your original designs to help your game work as intended. You will develop all of your code in one Python (PY) file, titled TextBasedGame.py.

Python (pycharm) In Project One, you designed pseudocode or flowcharts for thetwo main actions in the game: moving between rooms and gathering items.In this project, you will write the code for the full game

I have included my code and the output, I can't get my loop to work. Can you plase tell me where I went wrong in the code.

def show_instructions(): print('Thieving Gnome Adventure Game') print('Collect all of your stolen gardening tools to battle the thieving gnome') print('Move Commands: South, North, East, and West') print("Add to inventory: get 'Item Name'") rooms = { 'The Reception Room': {'East': 'The Parlor'}, 'The Parlor': {'South': 'The Dining Room', 'East': 'The Bedroom', 'North': 'The Library', 'West': 'The Reception Room'}, 'The Library': {'South': 'The Parlor', 'East': 'The Crafts Room'}, 'The Crafts Room': {'West': 'The Library'}, 'The Dining Room': {'North': 'The Parlor', 'East': 'The Kitchen'}, 'The Kitchen': {'West': 'The Dining Room'}, 'The Bedroom': {'West': 'The Parlor'} } items = { 'The Reception Room': 'None', 'The Parlor': 'Gardening Gloves', 'The Library': 'Axe', 'The Crafts Room': 'Gardening Fork', 'The Dining Room': 'Rain Boots', 'The Kitchen': 'Garden Trowel', 'The Bedroom': 'The Gnome' } room = 'The Reception Room' inventory = [] def get_new_state(state, directions): new_rooms = state for k in rooms: if k == state: if directions in rooms[k]: new_rooms = rooms[k][directions] return new_rooms while 1: print("You are in the ", room) if room == 'The Bedroom': print('Battling with the thieving gnome', end='') for i in range(50): for j in range(1000000): pass print(".", end='', flush=True) print() if len(inventory) == 5: print('You won - Congratulations') else: print('Sorry, you lost - collect all five items next time') break print('In this room the item is', items[room]) print('You currently have', inventory) direction = input('Enter item you want OR direction to go OR exit to give up:') if direction.lower() == items[room].lower(): if items[room] not in inventory: inventory.append(items[room]) direction = direction.capitalize() if direction == 'Exit': exit(0) if direction == 'East' or direction == 'West' or direction == 'North' or direction == 'South': new_room = get_new_state(room, direction) if new_room == room: print('Please enter another room to continue on your journey.') else: room = new_room else: print("invalid direction!")

def show_instructions(): print('Thieving Gnome Adventure Game') print('Collect all of your stolen gardening tools to battle the thieving gnome') print("Move Commands: South, North, East, and West') print("Add to inventory: get 'Item Name'') rooms = { "The Reception Room': {'East': 'The Parlor'}, 'The Parlor': {' South': 'The Dining Room', 'East': 'The Bedroom', 'North': 'The Library', 'West': 'The Reception Room'}, 'The Library': {'South': 'The Parlor', 'East': 'The Crafts Room'}, 'The Crafts Room': {'West': 'The Library'}, 'The Dining Room': {'North': 'The Parlor', 'East': 'The Kitchen'}, "The Kitchen': {'West': 'The Dining Room'}, 'The Bedroom': {'West': 'The Parlor'} } Ditems = { "The Reception Room': 'None', "The Parlor': 'Gardening Gloves', 'The Library': 'Axe', 'The Crafts Room': 'Gardening Fork', "The Dining Room': 'Rain Boots', "The Kitchen': 'Garden Trowel', "The Bedroom': 'The Gnome' } room = 'The Reception Room' inventory = [] Edef get_new_state(state, directions): new_rooms = state for kin rooms: if k == state: if directions in rooms[k]: new_rooms = rooms[k][directions] return new_rooms while 1: print("You are in the ", room) if room == 'The Bedroom': print('Battling with the thieving gnome', end='') for i in range (50p) : for j in range(1000000): pass print(".", end='', flush=True) print() if len(inventory) == 5: print('You won Congratulations') else: print('Sorry, you lost - collect all five items next time') break print('In this room the item is', items[room]) print('You currently have', inventory) direction = input('Enter item you want OR direction to go OR exit to give up:') Hif direction. lower() == items[room].lower(): if items[room] not in inventory: inventory.append(items[room]) A direction = direction.capitalize() if direction == 'Exit': exit(0) Hif direction == 'East' or direction == 'West' or direction == 'North' or direction == 'South': new_room = get_new_state(room, direction) if new_room == room: print("Please enter another room to continue on your journey.') else: room = new_room else: print("invalid direction!") You are in the The Reception Room You are in the The Reception Room You are in the The Reception Room You are in the The Reception Room You are in the The Reception Room You are in the The Reception Room You are in the The Reception Room You are in the The Reception Room You are in the The Reception Room You are in the The Reception Room You are in the The Reception Room Process finished with exit code -1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!