Skip to content

Instantly share code, notes, and snippets.

@xpqz
Created December 15, 2021 13:14
Show Gist options
  • Select an option

  • Save xpqz/75a25a23365da82448cbbe47ce46c1c4 to your computer and use it in GitHub Desktop.

Select an option

Save xpqz/75a25a23365da82448cbbe47ce46c1c4 to your computer and use it in GitHub Desktop.
AoC 2021, day 15, Dyalog APL
⎕IO0
'wpath'⎕cy'dfns'
d¨¨⎕NGET'../d/15'1
shifts{(,2/)(2/,)(2)(2)}
day15{
nnnn{~¯1}¨,2 0 1¯1shifts()(×/)
flat
values{flat[]}¨nnnn
graph(nnnn)(values)
pathgraph wpath 0 (¯1+flat)
+/1flat[path]
}
day15 d
merge{((×)0 2 1 3)}
day15 9@(0=9|mddd)9|mdddmerge (5 5d)+.+5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment