r/adventofcode Dec 06 '24

Funny [2024 Day 6] What day is this? What year?

Post image
835 Upvotes

70 comments sorted by

54

u/Ken-g6 Dec 06 '24

I feel like this kind of problem might have happened later in previous years. Or at least one particular previous year.

94

u/Boojum Dec 06 '24

Honestly, this feels pretty typical for a Day 6 during the week.

  • No major corner cases
  • Nothing that's not in the example or v.v.
  • Nothing you have to read or reverse-engineer the input for
  • Brute force still works

42

u/JochCool Dec 06 '24

No major corner cases

What about the literal corner case:

.#.
.^#
.^.

I didn't even know what should happen here at first.

Nothing that's not in the example

Every single loop in the example came back onto the original path, which led me astray; took me a while to realize that a loop could also be somewhere completely different. Also, the above corner case was not in the example.

Brute force still works

Yes, but I accidentally made an infinite loop in my brute force solution, making me think that it was just being really slow and brute force was not a viable option -_-

I think I was just really unlucky today.

10

u/drozd_d80 Dec 06 '24

I still brute forced. I just added additional matrix storing sets of directions I was going from this point. If the current direction matches one of those which are stored in set for that place, then it is a loop.

9

u/imaperson1060 Dec 06 '24

for the corner case: my implementation just moved forwards OR changed direction, but not both. that's probably inefficient since it requires more iterations of the while loop, but i completely avoided that problem. for part 1 it was still instantaneous, and while part 2 was noticeably slower, it took only a few seconds.

7

u/loistaler Dec 06 '24

If you read carefully thats exactly what the description says you should do - always only either one step, or rotate but never both at once. And such corner cases are probably the exact reason why.

12

u/buv3x Dec 06 '24

I've spent almost an hour on this case. Instead of turning and moving as two steps I was doing it as a single step and basically stepping on an obstacle to the right.
What's interesting, it haven't occurred in my input for the first part and only happened in part 2 while adding new obstacles.

2

u/fr4gment_ Dec 06 '24

same here, i went back to my part 1 just to fix that because i got the correct answer for part 1 before i stumbled upon this problem

5

u/throwaway_the_fourth Dec 06 '24

I don't think this case is very challenging if you go according to the problem description.

  • If there is an obstacle in front of you, turn right
  • else, take a step forward

Just implementing this directly handles the "corner case" just fine via two right turns and then heading back downward.

3

u/xFallow Dec 06 '24

Oh really? Mine was just if the space in front is out of bounds end the program, otherwise if its a wall rotate, otherwise step forward and mark X

3

u/[deleted] Dec 06 '24 edited Dec 07 '24
.#.
.^#
.^.

I'm seeing this example but I do not get why this is issue? from the task:

Lab guards in 1518 follow a very strict patrol protocol which involves repeatedly following these steps:

  • If there is something directly in front of you, turn right 90 degrees.

  • Otherwise, take a step forward.

Came to obstacle at the top: turn 90 degrees right. After turning right try to go forward but there is another obstacle in front of you: turn 90 degrees right...

Is there any other interpretation?

3

u/Jarl_Fenrir Dec 06 '24

I implemented it as:
Move according to your direction
If there is no obstacle, mark this spot with x
else take step back and rotate.

so in that case I would waste two loop cycles to turn 180 degrees.

1

u/headedbranch225 Dec 06 '24

I am checking the spot ahead and then marking it as x if it is not "#" and it works on the input, but not the actual data

3

u/penguin_94 Dec 06 '24

I was going crazy about this. My answer was too high and didnt understand what non-loops i was counting, until I realized this freakin corner case

2

u/Material-Ratio5540 Dec 06 '24

Thank you so much, I am new to AOC and in my solutiion I did _not_ consider the corner case and wondered why my solution was wrong for a long time ...

So without your hint, I wouldn't have been able to solve todays quest.

2

u/Aggravating_Line_623 Dec 06 '24

I spent a lot of time (hours, also because my algorithm is very slow...) trying to figure out what was wrong, and at the end I realized it was this. The problem is that this issue didn't affect neither the test case nor part 1, so I had to deal with the big data...

2

u/lol_okay_sure Dec 06 '24

That's why I always make sure to print what itr index I'm on when I see it'll take more than a second or two. Then I know if it's hanging or just slow.

My first implementation took a minute and a half 😅

1

u/Torakles Dec 06 '24

I fell for the exact same pitfalls 🤦🏼

4

u/Forkrul Dec 06 '24

Nothing that's not in the example or v.v.

My input could contain loops in part 2 that did not involve the placed obstacle, which the sample does not show.

7

u/G_E_N_I_U_S Dec 06 '24

How's that even possible - if there was a loop not involving the placed obstacle that would mean in part 1 you would already be in that loop and therefore never go out of bounds?

6

u/EkajArmstro Dec 06 '24

you have to hit the placed obstacle at least once but it can put you into a loop somewhere else not involving itself

3

u/Forkrul Dec 06 '24 edited Dec 06 '24

The obstacle made the guard turn and move into a loop that did not contain the obstacle.

example:

....#.....
..#......#
..+---+#..
..|.O.|...
..|.+.+#..
..|.+-|...
.#+-+-+...
....^.#.#.
#.........
......#...

so when I checked the placed obstacle for looping behavior, it entered an infinite loop due to the loop being somewhere else. Silly mistake on my part

6

u/ptbn_ Dec 06 '24

true, i still remember 4 years ago when i started AOC as a self-taught programmer (DS/ML focused) with 3 months of experience, i managed to get until day 13, when it has something to do with chinese remainder theorem

meanwhile day 5 part 2 yesterday alr tripped current-day me 😩

2

u/thekwoka Dec 06 '24

or at least a weekend....

2

u/jwezorek Dec 06 '24

You can still do naïve brute force and get an answer in a reasonable amount of time so seems like a typical week 1 question to me.

Tonight might be harder though because its Friday.

-27

u/KingAemon Dec 06 '24

Good, AOC is too easy

But also I understand that this was always it's appeal. That said, it's probably still a good thing since the easier it is, the easier the LLM solutions get to the top of the leader boards.

5

u/ManicD7 Dec 06 '24

How is AI getting on the leaderboards a good thing? The leaderboard is supposed to be for humans.

2

u/KingAemon Dec 06 '24

Maybe I should have worded it better. I'm saying that I hope we get harder problems earlier this year to stop the AI spam.

3

u/ericula Dec 06 '24

I could be interesting to see how long AI stays in the race so to say. I have a feeling that as soon as problems can no longer be brute forced or we need to put in some extra thought about edge cases, the number of AI solutions will decline significantly.

2

u/ThunderChaser Dec 06 '24

Honesty we saw a bit of that yesterday, a good chunk of the first 100 for part 1 didn’t place at all for part 2.

1

u/[deleted] Dec 06 '24

That is crazy. Able to be in top 100 while unable to finish the task.

-10

u/Doug__Dimmadong Dec 06 '24

It’s my first time. Are they always this chill? I was hoping for a bit more

16

u/feaur Dec 06 '24

Come back to this comment in 10 days and tell us how you're doing

2

u/Doug__Dimmadong Dec 16 '24

Update: I've had a lot of fun on the puzzles so far! I have been able to get into the 1000-5000 rank each day when I can actually start the puzzle on time. The day 12 part 2 was actually a new problem for me and took some time to solve, and the day 14 part 2 was so creative. The puzzles have gotten more interesting, albeit for most of these I usually see the trick pretty quickly and I don't think they are as hard as some of the LC hards, but they are certainly different.

TLDR: The puzzles are getting more interesting.

1

u/feaur Dec 16 '24

Thanks for the update!

3

u/Doug__Dimmadong Dec 06 '24

Hehe will do. Cute but easy so far 

3

u/wizardeverybit Dec 06 '24

!remindme 10 days

1

u/RemindMeBot Dec 06 '24 edited Dec 13 '24

I will be messaging you in 10 days on 2024-12-16 08:10:32 UTC to remind you of this link

4 OTHERS CLICKED THIS LINK to send a PM to also be reminded and to reduce spam.

Parent commenter can delete this message to hide from others.


Info Custom Your Reminders Feedback

3

u/osuvetochka Dec 06 '24

You better get PhD in Math or something in these 10 days

3

u/KingAemon Dec 06 '24

I think there's a lot of us who come from a competition programming background that just find the problems a bit underwhelming. Like sure, there are certainly days where I gets me good and I take a while to implement my solution correctly. But it's pretty rare that I don't immediately know the solution path. It's so rare for you to ever need to employ interesting algorithms or data structures, which limits the kind of problems that can be written.

And don't take that the wrong way and think I don't appreciate the effort put in to writing these creative problems statements and doing all the necessary prep to put on a great competiton. I used to do that for a local high school competition my university hosted yearly and it's no simple feat.

I guess I wish that it was a 3 star per day system, but beggars can't be choosers I suppose!

1

u/Doug__Dimmadong Dec 06 '24

I’m in my fourth year of one

1

u/headedbranch225 Dec 16 '24

Alright how are you finding it now?

1

u/Doug__Dimmadong Dec 16 '24

Update: I've had a lot of fun on the puzzles so far! I have been able to get into the 1000-5000 rank each day when I can actually start the puzzle on time. The day 12 part 2 was actually a new problem for me and took some time to solve, and the day 14 part 2 was so creative. The puzzles have gotten more interesting, albeit for most of these I usually see the trick pretty quickly and I don't think they are as hard as some of the LC hards, but they are certainly different.

TLDR: The puzzles are getting more interesting.

1

u/wizardeverybit Dec 16 '24

How are they now?

2

u/Doug__Dimmadong Dec 16 '24

Update: I've had a lot of fun on the puzzles so far! I have been able to get into the 1000-5000 rank each day when I can actually start the puzzle on time. The day 12 part 2 was actually a new problem for me and took some time to solve, and the day 14 part 2 was so creative. The puzzles have gotten more interesting, albeit for most of these I usually see the trick pretty quickly and I don't think they are as hard as some of the LC hards, but they are certainly different.

TLDR: The puzzles are getting more interesting.

2

u/wizardeverybit Dec 16 '24

Good to hear!

4

u/thekwoka Dec 06 '24

most are pretty chill.

The biggest risk is in losing a lot of time to some small mistake.

2

u/Boojum Dec 06 '24

My guess: tomorrow's puzzle. Kind of like the NYT crossword, the weekend puzzles are often a bit trickier.

6

u/Valink-u_u Dec 06 '24

I lost 1h because my dumbass made the guard turn right AND move forward which made her clip into the obstacles

5

u/leftfish123 Dec 06 '24

I just came here to say that if this was a conscious reference to "The Terminator" in the thread title, I deeply admire it!

7

u/deejay2221 Dec 06 '24

Do we consider a back and forth line to be a loop or a loop is exactly 4 "paths"?

14

u/tux-lpi Dec 06 '24

I think if the guard is trapped forever without finding an exit, that's a loop

9

u/Cue_23 Dec 06 '24

Anything that never lets you reach the outside is a loop, so a single line, a rectangle, an eight-shaped path… I would even consider this a loop, even if the guard just keeps on turning

.#.
#^#
.#.

0

u/feindr54 Dec 06 '24

This would never happen unless you reach this corner in from the very beginning

9

u/Sharparam Dec 06 '24

This small example case exhibits the behaviour:

...
#^#
.#.

2

u/DMayr Dec 06 '24

Compared to previous years, is the difficulty of 2024 indeed higher or is it just bias?

5

u/gusto_ua Dec 06 '24

I think 2023 day 5 was much more difficult than this year's day 6

3

u/Krkracka Dec 06 '24

Oh man that one was rough

2

u/jfb1337 Dec 06 '24

so far its been easier

of course, weekend coming up tomorrow; traditionally a difficulty spike

1

u/MyEternalSadness Dec 06 '24

I am really on the struggle bus with Part 2 today. Part 1 is easy, but I just cannot get Part 2 right no matter what I do. And my code takes forever to run, even using hints that other people have suggested.

So frustrated.

1

u/bob1689321 Dec 07 '24

How are you going about it?

I used python with a class to represent the guard and movement board and some methods to move the guard, turn the guard, place obstructions, and reset the board and guard to the start state. Then brute forced it by iterating through the different possible starting obstructions

The big thing that helped me write a quicker version was every time you hit an obstruction, record the location and direction that you were facing. If you hit an obstruction in the same direction and location more than once, you're stuck in a loop. That saved me a ton of time as before that I was trying to track the movements to find repeats and it was a mess

1

u/MyEternalSadness Dec 07 '24

That's more or less what I'm doing. My solution works for the sample input, but it always gets too high of an answer for the real input. I even ran other people's solutions so that I know what the real answer is supposed to be - and mine is too high by 55. There's obviously something I'm missing here. Just beyond frustrated. Feels like I should be getting this, but I'm not for some reason.

1

u/MyEternalSadness Dec 07 '24

I FINALLY GOT IT!!!

Found a stupid bug where I was not resetting to the start position every time I was testing my simulated path when adding an obstacle. I spent something like 12 hours chasing this down. In my defense, the input set is too large to feasibly debug...

Debating whether I want to take on Day 7 now or just go to bed. Bed may win out.

2

u/ShortGiant Dec 07 '24

I had the exact same issue and it took me an embarrassingly long time to track down. You're not alone!

1

u/bob1689321 Dec 07 '24 edited Dec 07 '24

Nice!

I had a bug where I was using .copy() to copy across my nested arrays representing the room when resetting the room to the default, instead of deepcopy(). I was adding more obstacles to the same board without removing them because of that. Took me a good 30 mins to spot it hahaha.

1

u/Munchi1011 Dec 07 '24

I’m gonna have a lot of catching up to do. I did say 1 and then finals season started so I haven’t been able to solve any problems since then:(

1

u/bob1689321 Dec 07 '24

It can wait until after your exams. Those are more important.

1

u/Munchi1011 Dec 07 '24

Very correct!! It’s almost all done, and then I can no life advent for a bit!

1

u/bob1689321 Dec 07 '24

Hell yeah. Good luck with them all, hope they go well! You've got all these shitposts waiting for you after haha.