There being no other options to get deeper into the base, we take the ventilation duct. Which leads us into a cavern full of Christmas Trees, where the Elves have been working to finish decorating before the deadline. What they need from us is to figure out how many of the areas under the trees can fit the presents that are set to go there. The presents cannot be stacked... but can be rotated and flipped. And so we have a polyomino packing problem.
The input is in two sections. The first is a list of the 6 types of presents (polyominos). All of these in the example are heptominos that fit in a 3x3 square. That's also true of my input, except that one is a hexomino, and one a pentomino. The second section is 1000 lines, with a rectangle to fill followed by six numbers (the counts of each type of present to fit into that rectangle). All of these numbers are 2 digits. And so my first thoughts were that polyomino packing is an NP-complete problem, these numbers are looking big for that, and there's a 1000 of them. There needs to be some sort of cheese.
So I considered the 4x4 example in the text, where 2 U-heptominos get put together... resulting in less fragmentation loss (2/9 to 2/16). Maybe the game here was just to meet a certain level of efficiency? So looking at mine I could see ways to put things together to make more efficient rectangles, which would be easier to tile in bulk. Of course then there's the issue of meeting the counts of presents along side that (with the potential of getting into Gaussian elimination again).
But first, I figured that only a few of the 1000 would be tricky. So I decided to write a little exploratory script to just sort out the problems that didn't have enough space. I just quickly got the number of tiles in the presents (making use of =()= because it was a while since I'd used in for AoC);
foreach (@$desc) {
my $num =()= m/#/g;
$count += $num;
}
push( @sizes, $count );
Then just went through the presents testing for if the number of tiles required for presents was more than the area. This removed about 60%. Which was great, so I decided to look a bit closer and actually output the leeway to see the wriggle room (ie find the tight ones). Either an area was 1-3 short or 400-850 over (and the excess is always > 2.4 * #shapes). So I figured that was more than enough space to blindly put down presents and just submitted the count (which was correct).
Afterward, I added to the script the placing down (technically this "works" for test, in that it catches that it doesn't handle it... in theory an actual polyomino packing solver goes there):
my $tileGridSpots = int($width / 3) * int( $length / 3);
if ($tileGridSpots >= $numShapes) {
$part1++;
} else {
warn "Region with potential space we didn't prove found\n";
}
Since this puzzle is all cheese, it meant that I managed to get a star with dc on every day. In order to make this one have something to do, I did parse the input (using v1.4.1's ? extensively... the stack size z also gets a lot of fun use). Then I just do the basic area test:
tr '.#:x' '12 ' <input | dc -e'[q]sq?[z1<q???0[r[A~2/3R+rd0<D]dsDx+z2<I]dsIxr1+:p??z0<L]dsLx0[0z4-[d;p5R*3R+r1-d0<I]dsIx+4R4R*-d.1+/+?zRz1<M]dsMxp'
For part 2, as there's no global leaderboard to tell me my number, so I took my time and read it before submitting it. That was a nice consequence of that change. As for the switch to 12 days, that's fewer puzzles for Eric to make, but as I've said, that's also a lower granularity to put a difficulty curse on. So there needs to be more thought into that side of things, and I think this year did a good job of making sure there was a good number of puzzles accessible for beginners.
And so we come to the end of the review. AoC may have been a little bit rough to start (but 2015 was much better than I remembered), but it quickly found its footing and has been consistent ever since. Which is quite a feat. I'd like to thank everyone that's come along... it's been fun reading other peoples stories and about their solutions and approaches (and it added a bunch of things to the TODO of things to try and things to fix). I'd especially like to thank u/terje_wiig_mathisen for stepping in to cover a few days while I was traveling and dealing with things.
All there is now is to wait and prepare for December 2026.