-
Notifications
You must be signed in to change notification settings - Fork 0
/
robot.js
59 lines (54 loc) · 1.02 KB
/
robot.js
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
57
58
59
const stream = require('mithril/stream')
const robot = stream({
m0: 0,
m1: 0,
suck: false,
sw0: false,
sw1: false,
x: 0,
y: 10,
stackMax: 15,
queue: [
{stackMax: true},
{stack: 3},
{first: true},
{suck:true},
{stackMax: true},
{stack: 2},
{first:true},
{nosucky: true},
{stackMax: true},
{stack: 0},
// {first: true},
// {suck:true},
// {stackMax: true},
// {stack: 4},
// {first:true},
// {nosucky: true},
// {stackMax: true},
// {home: true}
],
stacks: [
{h: 4},
{h: 7},
{h: 5}
// ,
// {h: 0},
// {h: 1},
// {h: 0},
// {h: 0},
// {h: 7},
// {h: 8}
]
})
const r_switch = (k, a, b) => {
let r = robot()
r[k] = (r[k] == a) ? b : a
robot(r)
}
const r_set = (k,v) => {
let r = robot()
r[k] = v
robot(r)
}
module.exports = {robot, r_set, r_switch}