I wanted to get an idea of how the blocks were landing and here’s some thoughts on what I came up with:
- they were building a simple maze (duh I guess).
- the final (blocking) block is highlighted as a tiny red dot for half a second or so (edit: now flashing!).
- my generated path jumped about seemingly at random even when blocks landed elsewhere so I don’t animate the dropping of the first 1000 blocks as it’s more noise than data.
- the ~500 blocks before the final one don’t affect my path at all, so it’s quite a boring end.
- Lemmy doesn’t like long animations, so I skip 10 blocks at a time.
If you want to toast your CPU for a few seconds, here’s some terrible Uiua code.
Data ← ≡◇(⊜⋕⊸≠@,)°/$"_\n_" &fras "AOC2024day18.txt"
End ← 70_70
Count ← 1024
D₄ ← [1_0 ¯1_0 0_1 0_¯1]
Valid ← ▽¬⊸∊:▽⊸(≡/××⊃(≤⊢End|≥0))+D₄¤
BestLen ← ⍣(-1⧻⊢path(Valid|≍End)0_0↙:Data|∞)
Chop! ← ◌⍢(⨬(⊙◌+1|⊙⊙◌:):⟜^0⌊÷2+,,|>)
BadBlock ← -1Chop!(=∞BestLen)Count ⧻Data
Skip ← 1000
Step ← 10
Times ← ⍜(-Skip|⁅⍜(÷Step|⇡⌊))+1BadBlock
# paths - will ruthlessly spawn new threads until your CPU burns.
∵(×1_1_0)wait≡spawn(°⊚°□⊢path(Valid|≍End)0_0↙:Data)Times
¤∵(×0_0_1)⬚0+↯+1End0°⊚↙Skip Data # old blocks
+:∵(×0_1_1)≡(⬚0+↯+1End0°⊚↘Skip↙)Times¤Data # add new blocks
≡+ # superimpose
⊂:⍜(⊡|⋅1_0_0) ⊡BadBlock Data⊣. # Add frame for final block.
⍥(⊂:↙¯2.)10 # Freeze frame.
≡(▽⟜≡▽4) # Scale up.
&fwa "AOC2024day18.gif"gif 60
You must log in or # to comment.
Some, uhh, what code?
Wee-wuh 😉