ETOOBUSY 🚀 minimal blogging for the impatient
AoC 2016/11 - Part 2 solution
TL;DR
On with Advent of Code puzzle 11 from 2016: a solution for part 2, at the very last!
In previous post AoC 2016/11 - New successors we took a look a the last piece we needed to set up our search using AstarX.pm, so without further ado we can proceed:
my $outcome = astar(
start => $start,
goal => $goal,
distance => sub { return 1 },
heuristic => \&distance_to_goal,
identifier => \&id_of,
successors => \&successors_for,
);
say scalar($outcome->@*) - 1;
Now let’s run it (local version here):
$ time perl 11.pl 11.input2
57
real 3m37.668s
user 3m30.664s
sys 0m2.312s
Well well… not too terribly fast, but it’s still a reasonable time and it only got to about 1.2 GB of memory… which is fine for my resources.
So… now that I have eventually cracked down this puzzle, I can happily head to the reddit post about this puzzle and look through all the wild ideas that people had to improve efficiency.
It’s rewarding to be able to do this by having solved the puzzle myself without specific hints, and it’s thrilling that there is still so much to discover! For example, the top post for this code in Ruby says:
The code runs in about two seconds on my computer.
Now I’m intrigued!!!