This repository implements solutions to the puzzles in the 2020 Advent of Code using Golang.
This was a vehicle to learn Golang, so I presume not everything done here will be deemed idiomatic by Golang specialists.
Generally speaking, the solutions are organised predominantly for comprehension. They strive to arrive at an answer in a reasonable period of time, but they typically prioritise optimal understanding over optimal performance.
The examples are representative of my thinking and coding style.
The project requires golang 1.22.5
, but any reasonably current version of Golang will likely work. I tend to code done the middle of any language specification.
If you use a Golang manager that responds to .tool-versions
, you should be switched to 1.17.3
automatically. I recommend ASDF for those on platforms that support it.
Dependencies are tracked in the go.mod
. They should be downloaded automatically the first time
you run the main program or the tests.
$ go test
go: downloading github.com/franela/goblin v0.0.0-20211003143422-0a4f594942bf
go: downloading github.com/elliotchance/pie v1.39.0
AOC
...
- cmd: Runner for daily solutions
- data: Puzzle input organised by day
- doc: The calendar and puzzle descriptions
- pkg: Daily solutions and other homegrown utilities
Modify the runner in the cmd
directory to import and execute the daily
package of your choice.
Then execute the following command in your terminal from the project root.
$ make run
The only tests are a set of checks to verify solved puzzles.
I often refactor my solutions for clarity (or as I learn new techniques in subsequent puzzles), so it is helpful to have these simple tests to give my refactors some confidence.
To execute the tests, simply execute the following command in your terminal from the project root.
$ make verify