adventofcode

https://adventofcode.com/
Log | Files | Refs

commit a5c254930513abe8c9c79029b1c863a2620bc6c6
parent 3b897b6c1c52a813737c78f2b4effa7632944bf3
Author: mpizzzle <m@michaelpercival.xyz>
Date:   Sun, 12 Dec 2021 22:42:04 +0000

puzzle 6 part 2 complete

Diffstat:
M2021/puzzle_6.apl | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/2021/puzzle_6.apl b/2021/puzzle_6.apl @@ -1,8 +1,10 @@ #! /usr/bin/apl --script -input← ⍎'3,4,3,1,2' -input← 300 ⍴ ⊃ ⍎⎕FIO[49] 'files/6.txt' +input← i⍴⍨↑⍴⍉ i← ⊃ ⍎⎕FIO[49] 'files/6.txt' -⍴ { (c↓ d),⍨ 7 | d↑⍨ c← +/7<⍨ d← 1-⍨⍵ ,9/⍨+/0=⍵ } ⍣ 80 input ⍝ part 1 +s← {+/⍵ = input} ¨ 1-⍨⍳9 +r← {((6/0),(↑⍵ ),2/0) + 1⌽ ⍵ } ++/r⍣80 s ⍝ part 1 ++/r⍣256 s ⍝ part 2 )OFF