-
Notifications
You must be signed in to change notification settings - Fork 22
/
Agent.py
42 lines (36 loc) · 1017 Bytes
/
Agent.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
# Agent.py
import sys
import Action
class Agent:
def __init__(self):
pass
def __del__(self):
pass
def Initialize(self):
pass
def Process(self, percept):
valid_action = False
while not valid_action:
valid_action = True
if sys.version_info[0] < 3:
c = raw_input("Action? ") # Python 2
else:
c = input("Action? ") # Python 3
if c == 'f':
action = Action.GOFORWARD
elif c == 'l':
action = Action.TURNLEFT
elif c == 'r':
action = Action.TURNRIGHT
elif c == 'g':
action = Action.GRAB
elif c == 's':
action = Action.SHOOT
elif c == 'c':
action = Action.CLIMB
else:
print("Huh?")
valid_action = False
return action
def GameOver(self, score):
pass