Watch
1
0
Fork
You've already forked advent-of-code
0

2025 Day 12 Part 1

This commit is contained in:
Jeremy Kaplan 2026-01-04 11:12:07 -05:00
commit 72c469ee79

52
2025/day12.ua Normal file
View file

@ -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] ◴◡+
/+