Solutions for the 2024 Advent of Code
This project makes use of Go 1.23.3.
git clone [email protected]:heldeen/aoc2024.git
go test ./...
go build
To run a solution, use the problem name followed by the path to an input file.
For example, to run problem 2 a
:
$ go run ./main.go 2 a -i ./challenge/day2/input.txt
Day 2, Part A - Answer: 9633
Took 999.4µs
NOTE: Input file is optional and, if omitted, it's location will be inferred by the day parameter to be a file named input.txt
located in the challenge/dayX/
folder.
A generator program is included
$ go run ./main.go gen 7
Took 501.833991ms
This executes the logic in gen/problem.go
that makes templates for each day. For
example, go run main.go gen 9
will generate the following files:
cmd/importDay9.go
: A "glue" file combining commands for both of the day's problems to simplify wiring up subcommandschallenge/day9/a.go
: The main problem implementation stubbed out for Part A:func A(*challenge.Input) int
challenge/day9/a_test.go
: A basic test template for Part A- This contains a
const sample
that is meant to get the sample input from the AoC website problem description. It uses that to feed the solution input for testing.
- This contains a
challenge/day9/b.go
: The main problem implementation stubbed out for Part B:func B(*challenge.Input) int
challenge/day9/b_test.go
: A basic test template- This references the
sample
constant in the same day'sa_test.go
for testing the Part B solution.
- This references the
challenge/day9/input.txt
: The challenge input downloaded from the AoC website. Grab your https://www.adventofcode.comsession
cookie value and store it in~/.tokenfile
to enable this..idea/runtimeConfigurations/TestA_in_aoc2022_challenge_day9.xml
: The JetBrains Goland configuration for running the tests ina_test.go
..idea/runtimeConfigurations/TestB_in_aoc2022_challenge_day9.xml
: The JetBrains Goland configuration for running the tests inb_test.go
..idea/runtimeConfigurations/Run_aoc2022_challenge_day9_partA.xml.xml
: The JetBrains Goland configuration for running the solution ina.go
against the input..idea/runtimeConfigurations/Run_aoc2022_challenge_day9_partB.xml.xml
: The JetBrains Goland configuration for running the solution inb.go
against the input.
These solutions are licensed under the MIT License.
See LICENSE for details.