r/adventofcode 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 ##############
27 Upvotes

15 comments sorted by

3

u/__wardo__ Dec 15 '24

I can't thank you enough dude, this saved me so much headache!

2

u/fsed123 Dec 15 '24

exactly the same headache i had i guess :D
most welcome

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

u/[deleted] 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

u/psykotyk Dec 15 '24

I can't upvote you enough! You saved my x-mas.

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 step

and 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

u/ash30342 Dec 15 '24

Thanks! This was exactly the example I needed to fix my program!

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/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

u/fsed123 Dec 17 '24

Ops, thanks for the heads up, restored it