diff --git a/2025/day12.ua b/2025/day12.ua new file mode 100644 index 0000000..f0fd8d1 --- /dev/null +++ b/2025/day12.ua @@ -0,0 +1,52 @@ +~ "aoc.ua" ~ Lines Sections Words + +Sections &fras "input/day12.txt" + +~Present {Id Shape} + +ParsePresent ← ( + Lines + ⋕°$"_:" °⊂ + ⊙(=@# ≡°□) + Present +) + +~Region {W H Req} + +ParseRegion ← ( + °$"_x_: _" + ⊙⊙(Words) + ∩₃⋕ + Region +) + +⊃(≡◇ParsePresent ↘¯1|≡◇ParseRegion Lines°□⊣) + +⍤"3x3 bounding box" ≍ ¤[3 3] ◴⊸≡(△Present~Shape) + +⊃(⋅∘|∘) + +# bool ? Region Presents +Impossible ← ( + ×⊸⊃(Region~W|Region~H) + ⊙⊓(Region~Req|≡(/+♭ Present~Shape)) + ⊙(/+×) + > +) + +# int ? Width Height +Blocks ← ×∩(⌊÷3) + +# bool ? Region +Guaranteed ← ( + Blocks⊸⊃(Region~W|Region~H) + ⊙(/+ Region~Req) + ≤ +) + +⊃(≡⌟Impossible|≡Guaranteed) + +⍤"no searching required" ≍ [1] ◴◡+ + +◌ +/+