This is my attempt at solving each puzzle in the Advent of Code 2017 challenge. I've attempted all of these solutions using C++17.
If you are also attempting the challenge, please try and solve these on your own first.
I've never used CMake formally before, so I've tried to use it here. Each project should be broken up into two executables. I've made it so that the second part utilises the same codebase as the first part, but with the preprocessor definition AOC_PART2
to separate them. Each day's task is listed down below.
Take in a string of digits (given as a commandline argument), and compute a sum based on the digits.
Take in a file of integers separated by tabs (given as a commandline argument), and computes a checksum based on those numbers in each row.
Take in an integer and compute a value of a kind (either the Manhatten Distance or the next greatest value) based on that.
Take in a file of passphrases (lower-case character strings separated by spaces) (given as a commandline argument), and computes how many of those are valid.
Take in a file of integers, and computes how many steps it takes to leave the system.
Take in a file of one row of tab separated integers, and compute how many steps it takes to reach a duplicate state using certain rules.
Take in a file describing a tree structure out of order, and compute the root node's name, and the correct value of an incorrect node.
Take in a file describing register operations and conditions, and compute the highest value at the end, and at any point in the program.
Take in a file of a stream of characters, and compute its score and the number of garbage characters in it.
Take in a file of comma-separated integers, and compute a Knot Hash value based on that.
Take in a file of hexagonal directions, and compute how far away the path leads.
Take in a file of connections, and determine how many are connected to a program.
Take in a file of layer sizes, and determine the severity of the system and how much of a delay to use before passing through.
Take in an input string, and, using the KnotHash algorithm, count the number of squares and regions in the grid.
Take in two starting values, and compute how many times the two generators match values.
Take in a file of instructions and compute the end state of a list of positions after those instructions.
Take in a step amount, and compute a circular buffer of integers based on that.
Take in a file of instructions, and compute the first recovered value, and how many send operations occurred.
Take in a diagram and paths, and follow it to compute a string.
Take in a list of positions, velocities, and accelerations, and compute which is the closest to the origin.