diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2015-12-19 18:04:10 +0100 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2015-12-19 18:04:10 +0100 |
commit | 16625179ec285a8d5c70b459e29fd8d2c33771f9 (patch) | |
tree | 8cab1dd93d1626b95a4741c39f104e0b5dad5110 /day18.k | |
parent | 7d84c1af0ce5c4412cd2af0b50a3fe93b8cf627c (diff) | |
download | adventofcode2015-16625179ec285a8d5c70b459e29fd8d2c33771f9.tar.gz adventofcode2015-16625179ec285a8d5c70b459e29fd8d2c33771f9.tar.xz adventofcode2015-16625179ec285a8d5c70b459e29fd8d2c33771f9.zip |
day18
Diffstat (limited to 'day18.k')
-rw-r--r-- | day18.k | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/day18.k b/day18.k new file mode 100644 index 0000000..1ee4395 --- /dev/null +++ b/day18.k @@ -0,0 +1,18 @@ +d:{".#"?/:x}'0:"day18"; + +h:{-1 _ ++0,x}; n:{1 _ ++x,0}; + +life:{ +/ breaks kona: s:(h@d)+(n@d)+(h'd)+(n'd)+(n'h@d)+(h'h@d)+(h'n@d)+(n'n@d); +s:(h@x)+(n@x)+(+h@+x)+(+n@+x)+(+n@+h@x)+(+h@+h@x)+(+h@+n@x)+(+n@+n@x); +:((x=1)&(s=2)|(s=3))|(x=0)&(s=3) +}; + +s: 100 life/d; ++/+/s + +m:(^d)#0; +m[0 99; 0 99]: 1; + +s: 100 {m|life[x]}/d; ++/+/s |