Unable to load image

rDrama Advent of Code Day 17: It's the weekend, why are you here? Edition

Summary for those just joining us:

Advent of Code is an annual Christmas themed coding challenge that runs from December 1st until christmas. Each day the coding problems get progressively harder. We have a leaderboard and pretty good turnout, so feel free to hop in at any time and show your stuff!

Whether you have a single line monstrosity or a beautiful phone book sized stack of OOP code, you can export it in a nice little image for sharing at https://carbon.vercel.app

What did you think about today's problem?

https://adventofcode.com/2023

Our Code is 2416137-393b284c (No need to share your profile, you have the option to join anonymously if you don't want us to see your github)

31
Jump in the discussion.

No email address required.

>dijkstra doesn't work since there's no way of knowing if a cheaper/equal path might cause a 4-line in the future

I'm gonna find Eric's minecraft base and puts lots of TNT under it

EDIT: YES FUCK THANK GOD I'M NOT FILTERED

DY DX←⍴r←⍎¨↑⊃⎕NGET'17.ex'1
⍝ Set to 0 3 for part 1, or 4 10 for part 2.
I J←4 10
q←,⊂0 1 1 0 0 0
v←⍬

us←{c←(0 1)(0 ¯1)(1 0)(¯1 0\. ⋄ m1←⍵∘≢¨⊂¨c ⋄ m2←(-⍵)∘≢¨⊂¨c ⋄ c/⍨m1∧m2}
a←{
    t←⊂w y x dy dx l←⊃⍵
    (dy≡0)∧(dx≡0):⍬
    (l>¯1+J):⍬
    y2←y+dy ⋄ x2←x+dx
    y2<1:⍬ ⋄ y2>DY:⍬ ⋄ x2<1:⍬ ⋄ x2>DX:⍬
    ⊂(w+(⊂y2 x2)⊃r) y2 x2 dy dx (l+1)
}
u←{
    t←⊂w y x dy dx l←⊃⍵
    (l<I)∧(~(dy≡0)∧(dx≡0)):⍬
    n←us⊂dy dx
    e←{dy dx←⍵ ⋄ ny nx←(y+dy)(x+dx)
        0(ny)(nx)(dy)(dx)1}¨n
    e←({_ y x _ _ _←⍵ ⋄ (0<y)∧(DY≥y)∧(0<x)∧x≤DX}¨⊢⍤/⊢)e
    w←{_ y x _ _ _←⍵ ⋄ ((⊂y x)⊃r)+w}¨e
    w,¨1↓¨e
}
b←{
    n1←a ⍵ ⋄ n2←u ⍵
    0⊣q⊢←(⊂∘⍋⌷⊣)∪q,n1,n2
}
p←{
    w y x dy dx l←⊃t←1⌷q
    s←⊂y x dy dx l
    (DY≡y)∧(DX≡x)∧(l≥I):t
    q⊢←1↓q
    s∊v:0
    v⊢←v,s
    y<1:0 ⋄ y>DY:0 ⋄ x<1:0 ⋄ x>DX:0
    0⊣b t
}
⎕←⊃⊃p⍣{0≢⍺}⊢0
Jump in the discussion.

No email address required.

can't apply djikstras when a trivial knot is thrown in

ngmi

Jump in the discussion.

No email address required.

:marseyitsover: :taycringe:

barely know how to do standard djikstras

Jump in the discussion.

No email address required.

t. using a fake language where you "import heap" aka have a library solve it for you. Real programmers implement their algorithms from scratch, at least until they realise the matrix has 6 dimensions and holy shit this is not happening :marseyitsover:

Jump in the discussion.

No email address required.

ACschewly it's import heapq

:#marseyakshually:

Jump in the discussion.

No email address required.

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