-
Notifications
You must be signed in to change notification settings - Fork 0
/
GameInteractor.py
51 lines (40 loc) · 1.01 KB
/
GameInteractor.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
def quitGame():
print("🔴 Quit the game and go back to main page.")
def goTo(direction):
print(f"👣 Walking {direction}...")
def save(item):
print(f"💾 You got {item} 1 ea")
# def interact(action):
# command = action.split()[0]
#
# if command == "walking":
# direction = action.split()[1]
# goTo(direction)
#
# elif command == "pickup":
# item = action.split()[1]
# save(item)
#
# elif command == "quit":
# quitGame()
#
# else:
# print("😵 Don't know this command")
def interact(action):
match action.split():
case ["walking", direction]:
goTo(direction)
case ["pickup", item]:
save(item)
case ["quit"]:
quitGame()
case _:
print("😵 Don't know this command")
interact("walking up")
interact("walking down")
interact("walking left")
interact("walking right")
interact("pickup pencil")
interact("pickup wand")
interact("quit")
interact("turnaround")