Unable to load image

rDrama Advent of Code Day 19: I don't have my PC please don't bully me for missing a day 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)

38
Jump in the discussion.

No email address required.

⎕PP←20
w p←⊃¨¨(≢¨⊆⊢)' '(≠⊆⊢)¨⊃⎕NGET'19.in'1 ⋄ c←'AR:><',⎕D,⎕C⎕A
p←⍎¨¨(∊∘⎕D⊆⊢)¨p ⋄ w←(∊∘c⊆⊢)¨w ⋄ ls←⊃¨w ⋄ f←⊃∘(¯1∘↑)¨w
w←{('xmas'⍳⊃⍵)(2⊃⍵)(⍎⍵/⍨⍵∊⎕D)(⍵↓⍨⍵⍳':')}¨¨¯1↓¨1↓¨w
c1←{i op v l←⍵ ⋄ (i⊃⍺)(⍎op)v:l ⋄ 0}
c2←{⊃(0∘≢¨⊢⍤/⊢)⍺∘c1¨⍵}
c3←{∨/⍵∊'AR':⊃⍵ ⋄ o←⍺ c2 w⊃⍨i←ls⍳⊂⍵ ⋄ o≡0:⍺∇i⊃f ⋄ ⍺∇o}
⎕←+/∊p/⍨'A'=c3∘'in'¨p

sl←{a b←⍺ ⋄ ⍵≤a:⍬(a,b) ⋄ (a<⍵)∧(⍵<b):(a,(⍵-1))(⍵,b) ⋄ ⍵≡b:(a,(b-1))(b,b) ⋄ (a,b)⍬}
sg←{a b←⍺ ⋄ ⍵<a:(a,b)⍬ ⋄ ⍵≡a:((a+1),b)(a,a) ⋄ (a<⍵)∧(⍵<b):((⍵+1),b)(a,⍵) ⋄ ⍬(a,b)}
sb←{op v←⍵ ⋄ op≡'<':⍺ sl v ⋄ ⍺ sg v}
d1←{i op v l←⍵ ⋄ ⍺∘{⍵@i⊢⍺}¨⊂¨(i⊃⍺)sb(op v)}
d2←{
  'A'≡⊃⍵:×/1+-/∘⌽¨⍺ ⋄ 'R'≡⊃⍵:0 ⋄ r←⍺ ⋄ i←ls⍳⊂⍵ ⋄ p←⍬
  +/d2/¨p,⊂r(i⊃f)⊣{T F←r d1 ⍵ ⋄ p⊢←p,⊂(T)(4⊃⍵) ⋄ F⊣r⊢←F}¨i⊃w
}
⎕←( 4⍴⊂1 4000 ) d2 'in'

More importantly, I finally did day 17:

https://i.rdrama.net/images/17029950398575385.webp

Left is my custom heap library I spent an evening writing, right is a sorted array. Interesting how they ended up so similar :marseyseethe:

Jump in the discussion.

No email address required.

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