Unable to load image

Advent of Code Day 5, AKA Stacks 101 :marseyinabox:

I actually stayed up to get a semi-decent score for once (being a eurocel for this is suffering). How are you all faring with shifting boxes around?

![](/images/16702184438592093.webp)

26
Jump in the discussion.

No email address required.

Loading data (programatically, not manually like some of you casuals):

r←⊢⎕FIO[49] 'day5raw.txt'
m←⍎¨¨{⊃¨(⊂2 4 6)⌷(' '≠⍵)⊂⍵}¨(0⍳⍨≢¨r)↓r
t←s←{↑(' '≠⍵)⊂⍵}¨{(,⍵)⊂⍨(2⌷⍴⍵)/⍳1⌷⍴⍵}⍉(⊃(¯2+0⍳⍨≢¨r)↑r)[;¯2+4×⍳9]

Part 1:

z←{{s[2⌷⍵]←⊂(1⌷⍵)↓⊃s[2⌷⍵]}⍵,{s[3⌷⍵]←⊂(⌽(1⌷⍵)↑⊃s[2⌷⍵]),(⊃s[3⌷⍵])}⍵}¨m ⋄ ↑¨s

Part 2 (only a single character removed from part 1):

z←{{t[2⌷⍵]←⊂(1⌷⍵)↓⊃t[2⌷⍵]}⍵,{t[3⌷⍵]←⊂( (1⌷⍵)↑⊃t[2⌷⍵]),(⊃t[3⌷⍵])}⍵}¨m ⋄ ↑¨t

:parrot:

Jump in the discussion.

No email address required.

You're my hero, but I also hate you.

Jump in the discussion.

No email address required.



Now playing: DK's Treehouse (DK64).mp3

Link copied to clipboard
Action successful!
Error, please refresh the page and try again.