-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.ts
39 lines (34 loc) · 985 Bytes
/
main.ts
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
//ENUMS
enum Three_Axis {
//% block="forward"
Forward,
//% block="left"
Left,
//% block="right"
Right
}
//GLOBAL VARIABLES
const communicationsTimeout = 75;
//% block="Mayan Mystery" weight=200 color=#0B3D91 icon="\uf186"
namespace mayanMystery {
/**
* This function moves the Agent
* in three directions
*/
//% block = "agent move %d by %n"
export function agent_move(d: Three_Axis, n: number): void {
for (let i =0; i < n; i++){
switch (d) {
case Three_Axis.Forward:
player.execute("scoreboard players set .output global 1")
break;
case Three_Axis.Left:
player.execute("scoreboard players set .output global 2")
break;
case Three_Axis.Right:
player.execute("scoreboard players set .output global 3")
}
loops.pause(communicationsTimeout)
}
}
}