/aoc2020

Advent of Code 2020 Solutions

Primary LanguageGoMIT LicenseMIT

Advent of Code 2020

Coverage Status Go Report Card License

Solutions for the 2020 Advent of Code

Building

This project makes use of Go 1.15.

go mod download
go test ./...

Running the Solutions

To run a solution, use the problem name followed by the path to an input file.

For example, to run problem 2a:

$ go run ./main.go 2 a -i ./challenge/day2/input.txt
Answer: 9633
Took 999.4µs

Adding New Solutions

A generator program is included in gen/problem.go that makes templates for each day. For example, go run gen/problem.go 9 a will generate the following files:

  • challenge/cmd/importDay9.go: A "glue" file combining commands for both of the day's problems to simplify wiring up subcommands
  • challenge/day9/a.go: The main problem implementation, containing a cobra command a and the implementation func A(*challenge.Input) int
  • challenge/day9/a_test.go: A basic test template
  • challenge/day9/b.go: The main problem implementation, containing a cobra command b and the implementation func B(*challenge.Input) int
  • challenge/day9/b_test.go: A basic test template
  • challenge/day9/input.txt: The challenge input

License

These solutions are licensed under the MIT License.

See LICENSE for details.