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
The MAA is responsible on a daily basis to protect office computers and patient records and personal information from hackers. R
d1i1m1o1n [39]

Two things that I can do in order to protect these assets with the use of the computer or the internet is by first, downloading and using an antivirus software where this has the ability to protect the computer from invaders, hackers and other viruses that could get into the system of the computer. Second, making the data encrypted, so that it will be protected with a code to prevent other people who are trying to get in the data.

3 0
3 years ago
Joshua is creating his résumé, in which section will he add projects and trainings he was involved in?
enot [183]
You put it in the skills and certifications section
4 0
2 years ago
What is theory of knowledge?​
Karolina [17]
Theory of knowledge (TOK) plays a special role in the International Baccalaureate® (IB) Diploma Programme (DP), by providing an opportunity for students to reflect on the nature of knowledge, and on how we know what we claim to know.
4 0
3 years ago
Arturo is a security professional. He is strengthening the security of an information system. His design ensures that if a field
Cloud [144]

Arturo is attempting to protect the database (data) of an information system (IS).

<h3>What is an information system?</h3>

An information system (IS) can be defined as a set of computer systems, that is typically used to collect, store, and process data, as well as the dissemination of information, knowledge, and the distribution of digital products.

In Cybersecurity, there are two (2) main techniques that can be used to check data when inputted in an information system (IS) and these include:

  • Verification
  • Validation

Data validation is a type of check which is primarily performed by a software program (application) to make sure that the data which is entered into an information system (IS) is allowable and sensible.

This ultimately implies that, any data that is not allowed or sensible are rejected and discarded by the computer system.

In conclusion, we can deduce that Arturo is attempting to protect the database (data) of an information system (IS).

Read more on data here: brainly.com/question/25885448

3 0
2 years ago
Match each vocabulary word to its definition.
Nana76 [90]

Answer:

Column matching given in explanation

1. Intranet :  <em>a network of computer within an organization</em>

2. Placeholder: <em>an empty area that reserves space for new content</em>

3. Presentation: <em>information delivered to an  audience</em>

4: Presentation Technology:  <em>a software application that helps  organize and convey information</em>

5. Keynote:   <em>the main speech delivered to all in attendance</em>

Explanation:

Intranet:

A small network that exist in the small organization or company to connect all the computers in organization.

Placeholder:

In computer programming, few variables has been defined in the start of program. These variables have no value initially but can be utilized at the time of need. These variable holds some space in memory that is called Placeholder.

Presentation:

A piece of information relevant to some particular topic, which will be delivered to a particular audience is called presentation.

Presentation Technology:

The tools that are used to assist presentation such as projector, slides, boards etc. are called presentation technology.

Keynote:

The main idea of speech that presenter want to deliver to the audience is called Keynote.

4 0
2 years ago
Other questions:
  • A database on a mobile device containing bands, sub-bands and service provider IDs allowing the device to establish connection w
    9·1 answer
  • The document responsible for describing the type of data stored in the database is called the:
    5·1 answer
  • Hello, can you help me answer these questions?
    9·2 answers
  • Write a for loop to verify that your function is correctly returning the expected output for the radius values between 0 and 11.
    14·1 answer
  • Test Average and Grade
    12·1 answer
  • Is it possible to uninstall a program that's on your phone from computer?
    8·1 answer
  • I need help answering these questions!
    11·1 answer
  • What is the process of copying items from ram to a storage device?
    8·1 answer
  • Describe an application or a situation in which it is not convenient to use a linked list to store the data of the application
    12·1 answer
  • A field value is currently not in any group. what happens when you try adding it to an existing group?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!