Unable to load image

rDramaAdvent of Code Day 4: Back on Track 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)

21
Jump in the discussion.

No email address required.

idk if im burnt out from tutoring bootcampers worse than i am over zoom for 3 hours or if its because i havent had a drink in 3 days but i still have no fricking clue what part 2 is trying to ask me to do so i shamelessly stole that part

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

Jump in the discussion.

No email address required.

The wording is retarded, they should've given a walkthrough.

Cards (you start with 1 of each): 1 1 1 1 1 1

Scores (from part 1): 4 2 2 1 0 0

Position 1: 1 card at this position, each scores 4. So add 1 to each of the next 4 cards.

       v
Cards: 1 1 1 1 1 1
  Add: 0 1 1 1 1 0
  New: 1 2 2 2 2 1

Position 2: 2 cards at this position, each scores 2. So add 2 to each of the next 2 cards.

         v
Cards: 1 2 2 2 2 1
  Add: 0 0 2 2 0 0
  New: 1 2 4 4 2 1

Position 3: 4 cards at this position, each scores 2. So add 4 to each of the next 2 cards.

           v
Cards: 1 2 4 4 2 1
  Add: 0 0 0 4 4 0
  New: 1 2 4 8 6 1

Position 4: 8 cards at this position, each scores 1. So add 8 to each of the next 1 card.

             v
Cards: 1 2 4 8  6 1
  Add: 0 0 0 0  8 0
  New: 1 2 4 8 14 1

Position 5: 14 cards at this position, each scoring 0. So add 14 to each of the next 0 cards (nothing).

                v
Cards: 1 2 4 8 14 1
  Add: 0 0 0 0  0 0
  New: 1 2 4 8 14 1

Position 6: 1 card at this position, each scoring 0. Add nothing.

                  v
Cards: 1 2 4 8 14 1
  Add: 0 0 0 0  0 0
  New: 1 2 4 8 14 1

Final cards: 1 2 4 8 14 1

Sum: 30

Jump in the discussion.

No email address required.

I don't know what you said, because I've seen another human naked.

Jump in the discussion.

No email address required.

it's saying duplicate the subsequent cards for as many "wins" as "current card" has

Card 1 has 4 wins, now Card 1 gets its original point, and cards ( 2 + 3 + 4 + 5 ) get a point because of Card 1's wins.

Onto Card 2, it gets the initial/original point, on top of the 1 point it had received from Card 1. So Card 2 has 2 points. Say it had just 1 win. With just 1 win on Card 2, it gives a point to only the next Card 3. But it does it again for each point it has, and gives Card 3 another point. Now Card 3 has 1 point from Card 1, 1 point from Card 2, and 1 point grom Card 2's repeat. So 3 points.

When Card 3's up, on top of the 3 points it has received, it also gets its initial/original point now that it's up.. so 4 points. But say it didn't have any wins, and basically passes 0 points down, four times. The game is still on because the next Card 4 had received a point from the first Card 1 and has 3 wins.

Card 4 has the 1 point from Card 1, and gets its initial/original point, so 2 points. It gives the next 3 cards a point, then since it's got one more copy it does it again so Card 5, 6, and 7 are given a total of 2 points each. Continues on until there's a dead end, then u sum all the points.

My answer was 11,787,590 lmao

Jump in the discussion.

No email address required.

Your pulitzer's in the mail

Jump in the discussion.

No email address required.

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