Uiua
Part 1 was easy, part 2 is ...less so...
a hint that might help you
visualising the data reveals some interesting patterns. Follow link to do so.
Any way, here's my Part 1 while I'm still thinking about this.
# AOC 2025 Day 09
# Experimental!
D β &fras"AOC2025day09.txt" # Drop your file here and edit name
/β₯/Γ+1β΅β/-βββ§
<2βΒ°csv D # Part 1
β§ββ‘β
1β(Λβ―0+1/β₯)βββ‘ββββΒ°csv D # Visualised data
Part 2
This is basically me thinking out loud, so it's untidy, brutal, repetitive and slow. (20s in the pad) link if you care
# Experimental!
# AOC 2025 Day 09
D β "7,1\n11,1\n11,7\n9,7\n9,5\n2,5\n2,3\n7,3"
D β &fras"AOC2025day09.txt" # Drop your file here and edit name
Parse β βΒ°csv
Partβ β /β₯/Γ+1β΅β/-βββ§
<2
Squeeze β βββ‘βββ # Squeeze (add a sort to inspect)
Draw β β§ββ‘β
1β(Λβ―0+1/β₯) # Draw
HLines β (
Squeeze Parse D
ββ(β‘β)ββΈβ‘β’
β§β(ββ‘Λβ(β|Λ=)βΛββ(β’β’|βββ‘Β°β+0_1β£β))
)
VLines β (
Squeeze Parse D
ββ(β‘β)ββΈβ‘β£
β§β(ββ‘Λβ(β|Λ=)βΛββ(β£β£|βββ‘Β°β+0_1β’β))
)
DrawBorder β ββVLines HLines Λβ―0β―2+1/β₯βSqueeze Parse D # Draws full border
# DrawBorder Squeeze # running this shows these as key boundary points -> [219 121] [219 123]
# ββ‘βΛβ¨[[219 121] [219 123]]βΈSqueeze # which map to -> [[94985 48652][94985 50114]]
# leftmost -> only look left, rightmost-> only look right
# SO, now fill the shape to make this easier.
Fill β (
ββ1 # fill colour.
Good β =0βββ‘β’ # Needs filling. Simple edges-check.
# Take first of list. If needs fill, do so and then add
# its four neighbours into queue. Repeat until queue is empty.
β’(⨬(β1|β΄β+A‰β β(β
β|β|β
β
β
β)β‘(β(β‘|β
β)β’))β‘Good
| >0β§»)
β
ββ
)
DrawBorder # Comment out everything below here to view the boundary.
Fill [219_120] # Now fill that boundary ([2_1] for test)
Squeeze Parse D
# ([0 1] for test)
[219 123] # [219 121] gave the wrong answer, so it's this.
β‘ββ # couple this with every other point
# Extract the covered window of the array for each pair of corners.
# (Very probably doing this the hard way:-()
# Only keep those that are all 1.
β½β€β‘β(=1/Γββ‘ββββΛββ©(βββ‘Β°β+0_1β)Β°ββ)
# Pick out our squeezed indices
β¨Squeeze Parse D
# Find out what the unsqueezed values were
ΛβParse D
# Find areas, return max.
/β₯β‘/Γ+1β΅β‘/-