Unable to load image
Reported by:

rDrama Advent of Code day 9: No Edition

Sorry I'm in a hospital waiting room just throwing this out quick

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)

37
Jump in the discussion.

No email address required.

https://i.rdrama.net/images/17020985700226877.webp TRANSB-WORD VICTORY EDITION B-WORD

Jump in the discussion.

No email address required.

Congratulations! Btw, you can install https://github.com/jeroenheijmans/advent-of-code-charts to see all sorts of interesting detailed statistics.

Jump in the discussion.

No email address required.

:#gigachadglow:

Jump in the discussion.

No email address required.

I don't think it has much to steal from that page.

Jump in the discussion.

No email address required.

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

:marseyworried:

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

Jump in the discussion.

No email address required.

I'm the last place person to have completed them all, and there are 12 places and 201 points between me and the next person with 100% completion. Comeback story when

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

Jump in the discussion.

No email address required.

Jump in the discussion.

No email address required.

https://media.giphy.com/media/pDgHg2Lcju3Ty/giphy.webp

Jump in the discussion.

No email address required.

Python:

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

Pretty straightforward today. Could be more efficient and cut out a few lines but I'm more happy to have my Saturday back.

That said, I can see this being much more painful for anyone not doing recursion.

Jump in the discussion.

No email address required.

r←⍎¨('-'⎕R'¯')¨⊃⎕NGET'9.in'1
q←{v←⍺↑⍵ ⋄ v⊣⍺∘{o⊣v⊢←v,⍺↑o←(¯2-/⊢)⍵}⍣{∧/0=⍺}⊢⍵}
⎕←+/+/¨¯1∘q¨r
⎕←+/-/¨1∘q¨r
Jump in the discussion.

No email address required.

Too easy, it reminded me of my algorithms exams in uni and school

Jump in the discussion.

No email address required.

It's one of those problems which is only easy if you know how to solve it.

If anything this was more like a tutorial on how to find the next number in a sequence. Expect that to come up again in a later day.

Jump in the discussion.

No email address required.

Yeah, easiest day so far.

Jump in the discussion.

No email address required.

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

Part2 was really simple today.

Most time was spent on moving from libc++ to libstdc++, because the former doesn't support std::views::slide yet. Which now after looking at cppreference, I could have just used https://en.cppreference.com/w/cpp/ranges/adjacent_transform_view to make it a lot simpler

Jump in the discussion.

No email address required.

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

Jump in the discussion.

No email address required.

Really fricked this one up, time wise. The one time I'm awake at 5 too :marseysad: .

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

Jump in the discussion.

No email address required.

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

My solution is slightly smaller but not as memory-efficient. :marseyshrug:

Jump in the discussion.

No email address required.

Nice. I looked for diff in the stdlib but was disappointed to find nim's diff is a line diffing algorithm for text.

Jump in the discussion.

No email address required.

Smaller improved version:

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

This uses a special parameter called a sink parameter. From the Nim manual:

To move a variable into a collection usually sink parameters are involved. A location that is passed to a sink parameter should not be used afterward. This is ensured by a static analysis over a control flow graph. If it cannot be proven to be the last usage of the location, a copy is done instead and this copy is then passed to the sink parameter.

Jump in the discussion.

No email address required.

@TriHard What you got today?

Jump in the discussion.

No email address required.

I quit last year because it's about low level grunt work and not systems engineering. Deal with it zoomer plebs.

Jump in the discussion.

No email address required.

>There's even a hang glider partially buried in the sand here

Is this a hamas reference?

Jump in the discussion.

No email address required.

I wish python had 1-based array indexing

This is my first year doing advent of code, glad I did it. I first learned programming by doing the Project Euler problems so this feels very nostalgic.

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

Jump in the discussion.

No email address required.

im gay

Jump in the discussion.

No email address required.

That doesn't make you special here

Jump in the discussion.

No email address required.

But I have the smaller peepee :marseydicklet:

Jump in the discussion.

No email address required.

This one was pretty simple

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

Jump in the discussion.

No email address required.

Short and sweet

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

Jump in the discussion.

No email address required.

I was so sure there would be some twist in part 2 to bite me in the butt for going with a recursive solution

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

Jump in the discussion.

No email address required.

Didn't even have to try for this one, the problem description pretty much guided you through the steps required to solve it

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

Jump in the discussion.

No email address required.

durrr I have one that doesn't resolve to 0 and I even checked by hand, it resolves all the way down to 2.

Am I missing a step in the instructions or something?

e: and if I don't use abs value for the difference it says I'm wrong

this is rigged

e: posting my beautiful monstrosity in case someone's bored enough to help

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

e: 1000DC to whoever figures out what my code is doing wrong (this just pt1 btw)


And it fits on the screen :D

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

Jump in the discussion.

No email address required.

I think one issue might be that your exit condition on the while loop is if the row sums up to 0, that could happen if the entire row is 0, but it can also wrongly happen if some negative values negate the positive values.

Jump in the discussion.

No email address required.

AND THE FINAL ANSWER WAS 5 OFF

lmao enjoy tha coins king

Jump in the discussion.

No email address required.

oh Jesus this gets me at least once a month

every time

Jump in the discussion.

No email address required.

smol bean UwU

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

Jump in the discussion.

No email address required.

Jump in the discussion.

No email address required.

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