-
Notifications
You must be signed in to change notification settings - Fork 0
/
year38-small.7bh
50 lines (43 loc) · 955 Bytes
/
year38-small.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
-- 7 Billion Humans (2215) --
-- 38: Seek and Destroy 3 --
-- INSTRUCTIONS: "Find and shred the smallest data cube in the room."
-- AVAILABLE COMMANDS: step, pickUp, drop, giveTo, takeFrom, nearest,
-- set, if, jump, end, comment
-- SIZE: 21 commands (challenge 22, shortest known 17)
-- BEST AVERAGE RUNTIME: 40 seconds (challenge 33, fastest known 11)
if s != shredder:
-- Find the smallest cube in the column directly above and bring
-- it back to the bottom wall.
mem2 = nearest wall
a:
step n
if c == datacube and
mem1 != datacube or
c < mem1:
mem1 = set c
endif
if n != nothing:
jump a
endif
pickup mem1
step mem2
drop
else:
-- Find the smallest cube in the line against the bottom wall.
mem2 = nearest shredder
step se
b:
if e == datacube:
if mem1 != datacube or
e < mem1:
mem1 = set e
endif
step e
endif
if e != hole:
jump b
endif
pickup mem1
giveto mem2
endif
-- vim: set autoindent noexpandtab