-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommands.py
56 lines (46 loc) · 1.53 KB
/
Commands.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
import MalmoPython
import time
class Commands(object):
def __init__(self, malmo_run):
self.mr = malmo_run
self.agent_host = self.mr.agent_host
def moveForward(self):
self.agent_host.sendCommand( "move 1" )
time.sleep(0.1)
#time.sleep(0.5)
#self.agent_host.sendCommand( "move 0" )
self.mr.getWorldState()
def moveBackward(self):
self.agent_host.sendCommand( "move -1" )
time.sleep(0.1)
#time.sleep(0.5)
#self.agent_host.sendCommand( "move 0" )
self.mr.getWorldState()
def moveRight(self):
self.agent_host.sendCommand( "strafe 1" )
time.sleep(0.5)
self.agent_host.sendCommand( "strafe 0" )
self.mr.getWorldState()
def moveLeft(self):
self.agent_host.sendCommand( "strafe -1" )
time.sleep(0.5)
self.agent_host.sendCommand( "strafe 0" )
self.mr.getWorldState()
def turnRight(self):
self.agent_host.sendCommand( "turn 1" )
time.sleep(0.1)
#time.sleep(0.5)
#self.agent_host.sendCommand( "turn 0" )
self.mr.getWorldState()
def turnLeft(self):
self.agent_host.sendCommand( "turn -1" )
time.sleep(0.1)
#time.sleep(0.5)
#self.agent_host.sendCommand( "turn 0" )
self.mr.getWorldState()
def startJump(self):
self.agent_host.sendCommand( "jump 1" )
self.mr.getWorldState()
def stopJump(self):
self.agent_host.sendCommand( "jump 0" )
self.mr.getWorldState()