-
Notifications
You must be signed in to change notification settings - Fork 0
/
ExecutionSkeleton.py
35 lines (22 loc) · 989 Bytes
/
ExecutionSkeleton.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
from FourRooms import FourRooms
def main():
# Create FourRooms Object
fourRoomsObj = FourRooms('simple')
# This will try to draw a zero
actSeq = [FourRooms.LEFT, FourRooms.LEFT, FourRooms.LEFT,
FourRooms.UP, FourRooms.UP, FourRooms.UP,
FourRooms.RIGHT, FourRooms.RIGHT, FourRooms.RIGHT,
FourRooms.DOWN, FourRooms.DOWN, FourRooms.DOWN]
aTypes = ['UP', 'DOWN', 'LEFT', 'RIGHT']
gTypes = ['EMPTY', 'RED', 'GREEN', 'BLUE']
print('Agent starts at: {0}'.format(fourRoomsObj.getPosition()))
for act in actSeq:
gridType, newPos, packagesRemaining, isTerminal = fourRoomsObj.takeAction(act)
print("Agent took {0} action and moved to {1} of type {2}".format (aTypes[act], newPos, gTypes[gridType]))
if isTerminal:
break
# Don't forget to call newEpoch when you start a new simulation run
# Show Path
fourRoomsObj.showPath(-1)
if __name__ == "__main__":
main()