diff options
-rw-r--r-- | day12 | 23 | ||||
-rw-r--r-- | day12.k | 7 |
2 files changed, 30 insertions, 0 deletions
diff --git a/day12 b/day12 new file mode 100644 index 0000000..7b0f5e2 --- /dev/null +++ b/day12 @@ -0,0 +1,23 @@ +cpy 1 a +cpy 1 b +cpy 26 d +jnz c 2 +jnz 1 5 +cpy 7 c +inc d +dec c +jnz c -2 +cpy a c +inc a +dec b +jnz b -2 +cpy c b +dec d +jnz d -6 +cpy 19 c +cpy 14 d +inc a +dec d +jnz d -2 +dec c +jnz c -5 diff --git a/day12.k b/day12.k new file mode 100644 index 0000000..8c6971b --- /dev/null +++ b/day12.k @@ -0,0 +1,7 @@ +p:" "\'0:"day12" +v:{(r,"i"$,x)"abcd"?*x} +e:{t:"abcd"?*|c:p[i]; i+:1; s:~[**c;] + $[s"c";r[t]:v@c@1; s"i";r[t]+:1; s"d";r[t]-:1; s"j";i+:(-1+v@*|c)*~0=v@c@1];r} + +r:4#0;i:0;*{i<#p}e/1 / 318077 +r:0 0 1 0;i:0;*{i<#p}e/1 / 9227731 |