commit b2f85e677c6134f90768e1f28d9101f576c8b44a parent 2c600fd864a33907b1b077656c9e3a91910dd60a Author: mpizzzle <m@michaelpercival.xyz> Date: Sat, 11 Dec 2021 00:47:37 +0000 formatting Diffstat:
| M | 2021/puzzle_4.apl | | | 8 | ++++---- |
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/2021/puzzle_4.apl b/2021/puzzle_4.apl @@ -4,11 +4,11 @@ input← ⎕FIO[49] 'files/4.txt' numbers← 1 + ⍎↑ input table_rows← 1 + ⍎ ¨ ((⍴ s) ⍴ ⍉ ∊ { 0 < ⍴ ⍵ } ¨ s) / s← 1↓ input -t← {⊃ (⊂ (⍵ × 5) + ⍳5)⌷ table_rows} ¨ 1 -⍨ ⍳5 ÷⍨ ⍴ table_rows +t← {⊃ table_rows ⌷⍨⊂ (⍵ × 5) + ⍳5} ¨ 1 -⍨ ⍳5 ÷⍨ ⍴ table_rows ⍝ table matrices -p← { { (1++/+⌿⍵ - 0 >⍨ ⍵ ) × {(0 ∊ +⌿⊃ ⍵ )∨ 0 ∊ +/⊃ ⍵ } ⍵ } ¨ ⍵ } ⍝ calculate winner -b← { ⊃ { ⍵ × ⍺ ≠ ⍵ }/(⌽ ⍵ ↑ numbers),⊂ t } ⍝ calculate reduced bingo round -w← { ⍵ /1 i⍴ ⍳i← ≢ ⍵ } ⍝ where (⍸) +p← { { (1++/+⌿⍵ - 0 >⍨ ⍵ ) × {(0 ∊ +⌿⊃ ⍵ )∨ 0 ∊ +/⊃ ⍵ } ⍵ } ¨ ⍵ } ⍝ calculate winners +b← { ⊃ { ⍵ × ⍺ ≠ ⍵ }/(⌽ ⍵ ↑ numbers),⊂ t } ⍝ calculate reduced bingo round +w← { ⍵ /1 i⍴ ⍳i← ≢ ⍵ } ⍝ where (⍸) all← {p b ⍵ } ¨ ⍳⍴ numbers