Skip Navigation

Search

Advent Of Code @programming.dev
mykl @lemmy.world

Visualisation

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.

 undefined
    
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
Time