Solutions to Advent of Code 2021 written in Go. This was part of my journey to learn Go; some solutions are messy, others are quite neat.
Apart from packages containing solutions to each day, there are also utility packages which include Go 1.18 generic implementations of a stack, queue and priority queue, as well as some other utility functions.
Some solutions which I found quite interesting:
- Day 15: Chiton - Pathfinding problem solved by implementing Djikstra initially and eventually switching to A* due to performance issues.
- Day 16: Packet Decoder - Packet decoding using recursion.
- Day 18: Snailfish - Parse expressions into unusual maths syntax involving pairs of numbers '[x,y]', with its own operations and which could be arbitrarily nested.
- Day 19: Beacon Scanner - Given sets of scanner reports, determine relative positions of scanners. This was tricky because scanners could be in different orientations.
- Day 21: Dirac Dice - Board game with 'quantum dice' - each roll splits the universe into multiple copies. Keep track of these possible universes and determine which player wins in more universes.
- Day 22: Reactor Reboot - Turning a series of cuboids on and off. These could be overlapping arbitrarily. My soltion included a cumbersome method of manually splitting two overlapping cuboids into their seven children cuboids.