-
Notifications
You must be signed in to change notification settings - Fork 0
/
year37-fast.7bh
143 lines (128 loc) · 1.89 KB
/
year37-fast.7bh
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
-- 7 Billion Humans (2215) --
-- 37: Dangerous Spreadsheeting --
-- INSTRUCTIONS: "Add up the contents of each row and write the result
-- to the cubes on the right side."
-- AVAILABLE COMMANDS: step, pickUp, drop, write, calc, set, if, jump,
-- end, comment
-- SIZE: 98 commands (challenge 13, shortest known 13)
-- BEST AVERAGE RUNTIME: 17 seconds (challenge 32, fastest known 16)
-- Align workers
step w
step e
mem1 = set e
-- Northernmost worker
if n != worker:
step e
step e
mem1 = calc mem1 + c
mem1 = calc mem1 + e
step e
step e
step e
step e
mem1 = calc mem1 + w
mem1 = calc mem1 + c
mem1 = calc mem1 + e
step e
jump a
endif
-- Southernmost worker
if s != worker:
step e
step e
step e
mem1 = calc mem1 + w
mem1 = calc mem1 + c
mem1 = calc mem1 + e
step e
step e
step e
mem1 = calc mem1 + c
mem1 = calc mem1 + e
step e
jump b
endif
-- 2nd northernmost worker
if n != worker:
step e
step e
step se
step ne
step e
mem1 = calc mem1 + w
mem1 = calc mem1 + c
step se
step ne
mem1 = calc mem1 + c
jump c
endif
-- 2nd southernmost worker
if s != worker:
step e
step e
step e
mem1 = calc mem1 + c
step se
step ne
step e
mem1 = calc mem1 + w
mem1 = calc mem1 + c
mem1 = calc mem1 + e
step e
jump d
endif
-- 3rd northermost worker
if n != worker:
step e
step e
mem1 = calc mem1 + c
mem1 = calc mem1 + e
step e
step e
step e
step e
mem1 = calc mem1 + w
mem1 = calc mem1 + c
mem1 = calc mem1 + e
step e
jump e
endif
-- 3rd southernmost worker
if s != worker:
step e
step se
step ne
step e
mem1 = calc mem1 + w
mem1 = calc mem1 + c
mem1 = calc mem1 + e
step e
step e
step e
mem1 = calc mem1 + c
jump f
endif
-- Center worker
step e
step e
step e
mem1 = calc mem1 + w
mem1 = calc mem1 + e
step e
step se
step e
step ne
mem1 = calc mem1 + c
-- Record final sums
a:
b:
c:
d:
e:
f:
step e
step e
pickup c
write mem1
drop
-- vim: set autoindent noexpandtab