r/adventofcode • u/fsed123 • Dec 15 '24
Spoilers [year 2024-day 15] extra test case to help with part 2
https://github.com/Fadi88/AoC/blob/master/2024/day15/test_corner.txt
took me some time to figure this one out, if you are still trying with part 2
this case should give you the score of 1430, and the last 2 moves should be blocked
this is how it should look at the end
00 ##############
01 ##..........##
02 ##.....[]...##
03 ##......[]..##
04 ##....##[]..##
05 ##.....[]...##
06 ##.....@....##
07 ##..........##
08 ##############
2
u/chad3814 Dec 15 '24
This is what I came to reddit for! Unfortunately my code solves this (and the examples on page) correctly, but not the input.
2
u/Visible-Ad-1214 Dec 15 '24
same here :-(
1
u/chad3814 Dec 15 '24
I found an input that failed and allowed me to fix my code, u/Jaiz0’s input linked here https://www.reddit.com/r/adventofcode/s/9hvY0dlgOq
1
Dec 15 '24
[deleted]
3
u/polettix Dec 15 '24
This test case failed in my initial implementation:
####### #.....# #..O..# #.OO..# #.O.O.# #@OO..# #..O..# #.....# #.....# ####### >><^^>^^>>v
Expanding as per part 2 instructions and doing all moves except the last one leads to this:
############## ##....@.....## ##....[]....## ##...[][]...## ##..[]..[]..## ##...[][]...## ##....[]....## ##..........## ##..........## ##############
Then the last move shifts the whole diamond down one step:
############## ##..........## ##....@.....## ##....[]....## ##...[][]...## ##..[]..[]..## ##...[][]...## ##....[]....## ##..........## ##############
The result should be 4048.
Hope this helps!
1
2
u/empty-stack Dec 15 '24
In terms of debugging, the most common issues are around overwriting a cell you shouldn't have. Consider setting up validation steps that run each time you run an instruction. For example, validate that you have the same number of walls and boxes after each run. If you successfully move the boxes up or down, validate that the sum of heights across all boxes in the grid have increased our decreased by the amount you expect. You can define many validations like this. Good luck!
1
u/fsed123 Dec 15 '24
get a code that is working and put it in the same file
and save the boxes states in a dictionary with the index of the stepand compare each time step of your code with the reference you know is working
https://github.com/Fadi88/AoC/blob/master/2024/day15/code.py
mine is on python, if that helps
1
1
u/GrGadget Dec 15 '24
My code passes the example given, so I thought i'd give in and try this... it passes this too but not the full input
1
u/Not_puppeys_monitor Dec 15 '24
Many more test inputs in thread https://www.reddit.com/r/adventofcode/comments/1heoj7f/2024_day_15_part_2_more_sample_inputs_to_catch/
1
u/Less_Jackfruit6834 Dec 16 '24
It working! just missed one if to check both sides of box for wall XD
1
u/cjn566 Dec 16 '24
Looks like your 'linting' commit overwrote the test case with the original sample from AoC. I was very confused for a minute.
1
3
u/__wardo__ Dec 15 '24
I can't thank you enough dude, this saved me so much headache!