-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathPyAgent.py
54 lines (40 loc) · 1.34 KB
/
PyAgent.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
# PyAgent.py
import Action
import Orientation
def PyAgent_Constructor():
""" PyAgent_Constructor: called at the start of a new trial """
print("PyAgent_Constructor")
def PyAgent_Destructor():
""" PyAgent_Destructor: called after all tries for a trial are complete """
print("PyAgent_Destructor")
def PyAgent_Initialize():
""" PyAgent_Initialize: called at the start of a new try """
print("PyAgent_Initialize")
def PyAgent_Process(stench, breeze, glitter, bump, scream):
""" PyAgent_Process: called with new percepts after each action to return the next action """
percept_str = ""
if stench == 1:
percept_str += "Stench=True,"
else:
percept_str += "Stench=False,"
if breeze == 1:
percept_str += "Breeze=True,"
else:
percept_str += "Breeze=False,"
if glitter == 1:
percept_str += "Glitter=True,"
else:
percept_str += "Glitter=False,"
if bump == 1:
percept_str += "Bump=True,"
else:
percept_str += "Bump=False,"
if scream == 1:
percept_str += "Scream=True"
else:
percept_str += "Scream=False"
print("PyAgent_Process: " + percept_str)
return Action.GOFORWARD
def PyAgent_GameOver(score):
""" PyAgent_GameOver: called at the end of each try """
print("PyAgent_GameOver: score = " + str(score))