Solutions for Advent of Code challenges implemented primarily in Go.
- Go 1.21.4 or higher
- A valid Advent of Code session cookie
-
Clone the repository
-
Set up your Advent of Code session cookie as an environment variable:
export AOC_SESSION=your_session_cookie_here
You can find your session cookie by:
- Logging into Advent of Code
- Opening browser developer tools
- Going to Application/Storage > Cookies
- Copying the value of the 'session' cookie
Run a specific day's solution:
go run cmd/main.go <day>
For example, to run day 1:
go run cmd/main.go 1
If no day is specified, it will default to day 1.
/cmd/main.go
- Main entry point/internal/dayN
- Solutions for each day/inputs
- Input files (automatically downloaded and cached)
Run tests for a specific day:
go test ./internal/day1
Run all tests:
go test ./...
- Automatic input fetching and caching
- Performance timing for solutions
- Modular structure for easy addition of new days