2025 Day 12 Part 1
This commit is contained in:
parent
e85a8dcff5
commit
72c469ee79
1 changed files with 52 additions and 0 deletions
52
2025/day12.ua
Normal file
52
2025/day12.ua
Normal 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] ◴◡+
|
||||||
|
|
||||||
|
◌
|
||||||
|
/+
|
||||||
Loading…
Reference in a new issue