From 8d32433194fb0a3d5591ccbb5e5fdcd7eaa44cc8 Mon Sep 17 00:00:00 2001 From: aprzn Date: Thu, 14 Dec 2023 10:31:52 -0500 Subject: [PATCH] day 14, part 1 --- day14.ua | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 day14.ua diff --git a/day14.ua b/day14.ua new file mode 100644 index 0000000..2b9caa8 --- /dev/null +++ b/day14.ua @@ -0,0 +1,32 @@ +$ O....#.... +$ O.OO#....# +$ .....##... +$ OO.#O....O +$ .O.....O#. +$ O.#..O.#.# +$ ..O..#O..O +$ .......O.. +$ #....###.. +$ #OO..#.... +TestInput ← + +Parse ← ⊜∘≠@\n. + +# the `n`th triangle number +Triangle ← ÷2×+1. + +# trans: switch from sliding north to sliding west, more convenient to work with +PartIOriginal ← ( + ⊃( + -⊃(+1≡(□⊂¯1⊚)=@#|⧻⊢) + | ≡(□⇌∧((⍜⊢(+1)|⊂0|∘)⊗⊙"O#")⊙[0]) + )⍉ + /+≡(/+-≡⊃(Triangle-:|Triangle)∩°□) +) + +SlideLeft ← ≡(⍜⊜□(≡(□⊐/⊂⊕□∩°□)=@..)≠@#.) +PartI ← /+♭×⊃(¤-⇡.⧻⊢|=@O)SlideLeft⍉ + +PartI Parse TestInput + +PartI Parse &fras "day14.in"