1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
k0ka [10]
2 years ago
12

I'm having trouble with an assignment of mine. I'm making a text based adventure game for extra credit in my class and I'm stuck

on where to continue the code. Basically it's a text based adventure game written in PYTHON. Effectively most rooms have an item and the player MUST obtain two of these items (The Magic Sword and Magic Shield) to defeat the lich, if the player does not have these items, then the game gives an instant game over. This is the code I have done so far, it's the going from room to room portion.
#First, all the rooms are set up.
rooms = {
'Entrance': {'East': 'Private Study'},
'Dining Hall': {'South': 'Kitchen', 'North': 'Entrance', 'East': 'Armory', 'West': 'Hidden Room', 'Item': 'Map'},
'Kitchen': {'North': 'Dining Hall', 'East': 'Dungeon', 'Item': 'Food'},
'Dungeon': {'West': 'Kitchen', 'Item' : 'Lich'},
'Old Bedroom': {'South': 'Armory', 'Item': 'Potion'},
'Armory': {'West': 'Dining Hall', 'North': 'Old Bedroom', 'Item': 'Magic Shield'},
'Private Study' : {'West' : 'Entrance', 'Item' : 'Hidden Room Key'},
'Hidden Room' : {'East' : 'Dining Hall', 'Item' : 'Magic Sword'}
}
#Then the starting room is set
room = 'Entrance'
#This definition will set up the function to move betweem rooms.
def move_to_room(room, direct):
new_room = room
for a in rooms:
if a == room:
if direct in rooms[a]:
if isinstance(rooms[a][direct], list): #This if function is set up incase there are ever two paths in a room
b = input()
if b == '1':
new_room = rooms[a][direct][0]
else:
new_room = rooms[a][direct][1]
else:
new_room = rooms[a][direct]
return new_room
#The while loop is the full gameplay loop, the majority in which the player will see.
#First it will display what room the player is currently in, then asks them what they wish to do.
while 1:
print('\nYou have entered', room)
print('If you wish to stop playing, please enter "Stop" or "stop"')
print("Please enter north, south, east, or west please.")
direct = input('\nWhich direction do you want to enter?: ')
#If the player enters stop, then the game stops
if direct == 'Stop' or direct == 'stop':
exit(0)
#The main if for moving between rooms, there is a a there are no paths, then they player cannot move that way
if direct == 'east' or direct == 'west' or direct == 'north' or direct == 'south':
new_room = move_to_room(room, direct)
if new_room == room:
print('There is a wall in your path! Please enter another direction: ')
else:
room = new_room
#Another if incase the player enters with capital letters in their directions
if direct == 'East' or direct == 'West' or direct == 'North' or direct == 'South':
new_room = move_to_room(room, direct)
if new_room == room:
print('There is a wall in your path! Please enter another direction: ')
else:
room = new_room
#If there is an invalid entry that doesn't fit in the rooms, then the player will be told to enter it again.
else:
print('\nINVALID DIRECTION, PLEASE ENTER A VALID OPTION')
Computers and Technology
1 answer:
mihalych1998 [28]2 years ago
7 0
Invalid format in my brain
You might be interested in
Tanner is creating a brochure for his Web-hosting company. He designed the layout and placed a picture in the center of the page
Romashka [77]
Resizing is a very simple process. On the photo editing program, simply click on the image, and if resize handles appear around it, click and drag those to the desired size. If the program has a dedicated resizing or rescaling tool, use it and follow the above instructions. Keep the photo proportionate by holding down the shift key while dragging a corner handle. <span>Tanner has to make sure that his photo his of a high enough resolution to resize. A pixellated or blurry photo will only get worse when scaled up. He also has to make sure he doesn't resize it to be too big or it will also end up pixellated.</span>
5 0
3 years ago
A series of dialog boxes that guides you through creation of a form or report is called a ____.
victus00 [196]

Answer:

c i think it mit be right i'm sorry if it's not ,

Explanation:

it's c or D.

4 0
2 years ago
1. Grouping Data in a Pivot Table can help you do what?
valentina_108 [34]

Answer:

1.Grouping data in a PivotTable can help you show a subset of data to analyze. For example, you may want to group an unwieldy list of dates or times (date and time fields in the PivotTable) into quarters and months, like this image. Note:  The time grouping feature is new in Excel 2016.

2.Select the rows or columns you wish to grouP

On the Data tab, in the Outline group, click the Group command.  

In the Group dialog box, select Rows or Columns and click OK.

3.Select the rows or columns you wish to ungroup.

On the Data tab, in the Outline group, click the Ungroup command.  

In the Group dialog box, select Rows or Columns and click OK.

4.

1.Launch Microsoft Excel.

2

Browse to and open the workbook file containing the pivot table and source data for which you need filter data.

3

Select the worksheet containing the pivot tab and make it active by clicking the appropriate tab.

4

Determine the attribute by which you want to filter data in your pivot table.  

The attribute should be one of the column labels from the source data that is populating your pivot table.

For example, assume your source data contains sales by product, month and region. You could choose any one of these attributes for your filter and have your pivot table display data for only certain products, certain months or certain regions. Changing the filter field would determine which values for that attribute are shown.

5

Force the Pivot Table Wizard or Field List to launch by clicking a cell inside the pivot table.

6

Drag and drop the column label field name you wish to apply as a filter to the "Report Filter" section of the pivot table field list.  

This field name may already be in the "Column Labels" or "Row Labels" section.

It may be in the list of all field names as an unused field.

7

Set the filter to display one of the values for the field.  

You can set the filter to display all values or only one. Click the arrow beside the filtered label and check the "Select Multiple Items" check box if you would like to select certain values for your filter.

Explanation:

PLZ MARK ME AS A BRAINLIST ;)

4 0
3 years ago
Consider a single CPU system with an active process A. Explain what happens in the following circumstances including any interru
Anika [276]

Answer:

The answer to this question as follows:

Explanation:

In option a, When we use fork, a new mechanism, that uses fork() method, which is in the parental process, to replicate all sites. It has been installed in a space-differentiating operating system.

In option b, It is the present system cycle that scan and wait for any of the system processor to be installed.

In option c,  The time delay happens when A operates. It is a global that make issues, which are cleared and slowed down when an interrupt happens. In this process, there are not any distractions. It splits into slowly as it heads into the ISR. It helps to understand the code easily.

5 0
3 years ago
A __________ is the blueprint for __________ having similar attributes and behaviors. signature, objects class, parameters heade
MrRa [10]

Answer: E. class, objects

Explanation:

<em>A </em><em><u>class</u></em><em> is the blueprint for </em><em><u>objects</u></em><em> having similar attributes.</em>

As much as classifying something means to define it based on the characteristics that is has that are similar to other things in that class, so also is a class here.

A class is the blueprint or rather template for making objects that have similar attributes which means that the class therefore gives the object its various attributes and its behavior.

4 0
2 years ago
Other questions:
  • Personal Web Page Generator Write a program that asks the user for his or her name, then asks the user to enter a sentence that
    11·1 answer
  • Mara's presentation included essential information about the company's new safety procedures. She wanted to make
    13·2 answers
  • ‘Bottom of the pyramid’ innovation refers to ancient Egyptian approaches to new product development – true or false?
    8·1 answer
  • When you use the fill handle to copy a formula to adjacent cells, this creates what kind of cell reference?
    5·1 answer
  • In computer logic what is order of instructions
    13·1 answer
  • Your _______ can help block inappropriate content online.<br> 1. web browser<br> 2. Password
    14·1 answer
  • I can't solve this <br> Python loop with while statement
    15·2 answers
  • What factors do network consultants consider when determining the network needs of a business? Use the space provided below to a
    6·1 answer
  • How do you reflect yourself in the topic (filters)​
    14·1 answer
  • Phân tích cạnh tranh của cocacola và pepsi
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!