2015/01: Initial commit

This commit is contained in:
Tom Willemse 2024-11-30 16:11:08 -08:00
commit a8f1a5ea12

54
2015/day-01/main.fs Normal file
View file

@ -0,0 +1,54 @@
: parse-instructions ( ulen addr -- )
0 >r
0 u+do
c@+
dup 40 = if
r> r> r>
1 +
>r >r >r
then
41 = if
r> r> r>
1 -
>r >r >r
then
loop
r> ;
s" (())"
parse-instructions
." return: " . cr drop
s" ()()"
parse-instructions
." return: " . cr drop
s" ((("
parse-instructions
." return: " . cr drop
s" (()(()("
parse-instructions
." return: " . cr drop
s" ))((((("
parse-instructions
." return: " . cr drop
s" ())"
parse-instructions
." return: " . cr drop
s" ))("
parse-instructions
." return: " . cr drop
s" )))"
parse-instructions
." return: " . cr drop
s" )())())"
parse-instructions
." return: " . cr drop
bye