-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_project_bcca.py
More file actions
105 lines (83 loc) · 3.48 KB
/
example_project_bcca.py
File metadata and controls
105 lines (83 loc) · 3.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
START_LOCATION = "ENTRANCE"
ENTRANCE_INFO = """The entrance is a small hallway with connections to the BCCA
offices and the main lobby.
You can go to:
- BCCA Offices: To the left is a hallway with offices for BCCA staff on either side.
- Lobby: Heading into the building leads into the main lobby area.
"""
LOBBY_INFO = """There are plenty of chairs and tables around.
There are a few large screen TVs over the tables against the walls.
You can go to:
- Incubator: On one end of lobby is an incubator space with offices.
- Classrooms: The other direction leads to the BCCA classrooms.
- Entrance: There is a double-door opening that leads back to the entrance.
- BCCA Offices: There is a doorway leading into the BCCA offices as you walk towards
incubator space.
"""
INCUBATOR_INFO = """The incubator space has a small seating area surrounded
by 6 office spaces. All of the office doors are locked.
You can go to:
- Lobby: There are two exits from the incubator space, but they both go to
the lobby.
"""
CLASSROOMS_INFO = """There is a long hallway separating 4 classrooms with glass,
interior walls. There is a small breakout room separating the two classrooms on
each side. The two classrooms closest to the lobby have an enormous AV setup.
The top of the hallway is lined with a mural describing a student's journey
through BCCA.
You can go to:
- Lobby: The only exit from the classrooms is back into the lobby.
"""
BCCA_OFFICES_INFO = """Along with a couple closets, there are offices for
Nate, Corey, Fernae, and Kagan.
You can go to:
- Lobby: There is a hallway between Nate and Fernae's offices that leads to the lobby.
- Entrance: Between two closets, there is a door leading back to the entrance.
"""
def print_info(location: str) -> None:
print(f"You are in the {location.title()}!")
if location == "ENTRANCE":
print(ENTRANCE_INFO)
elif location == "LOBBY":
print(LOBBY_INFO)
elif location == "INCUBATOR":
print(INCUBATOR_INFO)
elif location == "CLASSROOMS":
print(CLASSROOMS_INFO)
elif location == "BCCA_OFFICES":
print(BCCA_OFFICES_INFO)
def is_valid_transition(location: str, destination: str) -> bool:
if location == "ENTRANCE":
return destination == "BCCA_OFFICES" or destination == "LOBBY"
elif location == "LOBBY":
return (destination == "INCUBATOR" or destination == "CLASSROOMS"
or destination == "BCCA_OFFICES" or destination == "ENTRANCE")
elif location == "INCUBATOR":
return destination == "LOBBY"
elif location == "CLASSROOMS":
return destination == "LOBBY"
elif location == "BCCA_OFFICES":
return destination == "ENTRANCE" or destination == "LOBBY"
else:
return False
def invalid_destination_message(location: str, destination: str) -> str:
return f"You cannot go to {destination.title()} from {location.title()}."
def input_destination_or_q(location: str) -> str:
while True:
print("Where would you like to go? [q to quit]")
destination = input("> ").upper()
if destination == "Q" or is_valid_transition(location, destination):
return destination
else:
print(invalid_destination_message(location, destination))
def main() -> None:
location = START_LOCATION
while True:
print_info(location)
destination = input_destination_or_q(location)
if destination == "Q":
break
else:
location = destination
if __name__ == '__main__':
main()