-
Notifications
You must be signed in to change notification settings - Fork 0
/
year38-faster.7bh
68 lines (60 loc) · 1.07 KB
/
year38-faster.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
-- 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: 37 commands (challenge 22, shortest known 17)
-- BEST AVERAGE RUNTIME: 15 seconds (challenge 33, fastest known 11)
-- This fails a lot. I should annotate this, but I've spent all day on
-- it and really don't want to see it anymore for now. Perhaps in the
-- future.
mem1 = nearest shredder
if s == shredder:
giveto mem1
endif
mem2 = nearest wall
mem3 = nearest hole
step n
step n
step n
mem4 = set s
if c < mem4:
mem4 = set c
endif
if n < mem4:
mem4 = set n
endif
step n
step n
step n
if s < mem4:
mem4 = set s
endif
if c < mem4:
mem4 = set c
endif
if n < mem4:
mem4 = set n
endif
step n
step n
if c < mem4:
mem4 = set c
endif
if n < mem4:
mem4 = set n
endif
pickup mem4
step mem2
a:
mem2 = nearest worker
if myitem > mem2:
step mem3
endif
step mem2
if w == worker or
e == worker:
jump a
endif
giveto mem1
-- vim: set autoindent noexpandtab