Watch
1
0
Fork
You've already forked advent-of-code
0
advent-of-code/2025/day12.ua
2026-01-04 11:12:22 -05:00

52 lines
773 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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