Day 9: Movie Theater
Megathread guidelines
- Keep top level comments as only solutions, if you want to say something other than a solution put it in a new post. (replies to comments can be whatever)
- You can send code in code blocks by using three backticks, the code, and then three backticks or use something such as https://topaz.github.io/paste/ if you prefer sending it through a URL
FAQ
- What is this?: Here is a post with a large amount of details: https://programming.dev/post/6637268
- Where do I participate?: https://adventofcode.com/
- Is there a leaderboard for the community?: We have a programming.dev leaderboard with the info on how to join in this post: https://programming.dev/post/6631465


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 dataPart 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⌵≡/-