-
Notifications
You must be signed in to change notification settings - Fork 0
/
Adventure.py
88 lines (54 loc) · 1.8 KB
/
Adventure.py
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
# Lab 7 Dr. Roberto Joseph
room_list = [] # Empty List
current_room = 0
next_room = 0
# N,E,S,W
room = ["You're in Bedroom 2. There is a passage to the east.",3,1,None,None]
room_list.append(room)
room = ["You're in the South Hall",4,2,None,0]
room_list.append(room)
room = ["You're in Dining Room. There is a passage to the west.",5,None,None,1]
room_list.append(room)
room = ["You're in Bedroom 1",None,4,0,None]
room_list.append(room)
room = ["You're in North Hall",6,5,1,3]
room_list.append(room)
room = ["You're in Kitchen",None,None,2,4]
room_list.append(room)
room = ["You're in Balcony",None,None,4,None]
room_list.append(room)
done = False
while not done:
print(' ')
print(room_list[current_room][0])
user_input = input('What Direction? ')
# If user wants to go North
if user_input.upper() == "N":
next_room = room_list[current_room][1]
if next_room == "None":
print("You can't go that way!")
else:
current_room = next_room
# If user want to go East
elif user_input.upper() == "E":
next_room = room_list[current_room][2]
if next_room == "None":
print("You can't go that way!")
else:
current_room = next_room
# If user wants to go West
elif user_input.upper() == "W":
next_room = room_list[current_room][4]
if next_room == "None":
print("You can't go that way!")
else:
current_room = next_room
# If user want to go South
elif user_input.upper() == "S":
next_room = room_list[current_room][3]
if next_room == "None":
print("You can't go that way!")
else:
current_room = next_room
else:
print('Please try again, I dont understand what you typed')