-
Notifications
You must be signed in to change notification settings - Fork 0
/
year23.hrm
47 lines (35 loc) · 1.09 KB
/
year23.hrm
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
-- HUMAN RESOURCE MACHINE PROGRAM --
-- 23: The Littlest Number
-- INSTRUCTIONS: "For each zero terminated string in the INBOX, send to
-- the OUTBOX only the SMALLEST number you've seen in that string. You
-- will never be given an empty string. Reset and repeat for each string."
-- AVAILABLE COMMANDS: INBOX, OUTBOX, COPYFROM, COPYTO, ADD, SUB,
-- BUMPUP, BUMPDN, JUMP, JUMPZ, JUMPN, COMMENT
-- SIZE: 12 commands (challenge 13)
-- AVERAGE RUNTIME: 71 steps (challenge 75)
-- Tile 0: Running minimum
-- Maintain the minimum value seen in the current string so far. Send it
-- to the outbox when we encounter the end of the string.
JUMP b
a:
COPYFROM 0
OUTBOX
b:
INBOX
JUMP d
c:
ADD 0
d:
COPYTO 0
e:
INBOX
JUMPZ a
SUB 0
JUMPN c
JUMP e
DEFINE LABEL 0
eJzTYWBguOgc03TRecnWqU4Mp8ScNrwBCjF4uJtNNQhY0/s4ZE2vQphe/42Io/OvRSZuvhbZdi4qIvM5
SM2UKOd5BxI3TDBJ0+pRz37do5Lzvv9+Lsv8uXkRa+fmTb5+P1fvNUjdprrM7k119ifNanNfgfiG9Usi
QTRb/+O2lv6Aqx59Ru9A/Jb+tgW/JxVO1Jr5uE1q/vyW00sSWt2XPe88ukyvv3n58+3Ny9e8ZBgFo2AU
UBUAAF6iThI;
-- vim: set autoindent: