2025-advent-of-code

following along with the advent of code 2025 (Matlab)

View on GitHub

Day 04

The elves have stacked the toilet rolls (@) amongst other empty slots (.) in a storage room as shown below:

..@@.@@@@.
@@@.@.@.@@
@@@@@.@.@@
@.@@@@..@.
@@.@@@@.@@
.@@@@@@@.@
.@.@.@.@@@
@.@@@.@@@@
.@@@@@@@@.
@.@.@@@.@.

To get to them, they need space around them (<4 neighbouring rolls @)

Day 4
Toilet roll neighbour count from 0 (cold) to 8 (hot)

Tips

Second problem

The second problem is similar, but now you have to iterate the process described in step 1 until no more rolls can be removed.

Day 4 animated gif
Animated gif showing the iterative removal of toilet rolls by elves ;)

Code

Matlab solution

Matlab code / solution for the first part of that problem.

Second part solution of that problem.