Skip to content

vorban/advent-of-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation




advent-of-code

Advent of code solutions in Go

Compliance with AoC automation rules

This script/repo/tool does follow the automation guidelines on the /r/adventofcode community wiki.

Specifically:

  • Outbound calls are made to adventofcode.com/{year} only.
  • There is exactly 1 outbound call per year of advent of code, upon execution of the updateBadges script. Those calls are throttled to once every 2 seconds.
  • Results of all calls are cached for the day in cache/
  • The only way to bypass the cache is to manually delete it.
  • The User-Agent header in tools/updateBadges/scrap.go:fetchHtml() is set to the .env variables (prompted if missing).

Usage

go build -o bin ./cmd/solver.go
./bin/solver {year} {day} {silver|gold} [sample]

# if developing, you can simply run:
go run ./cmd/solver.go {year} {day} {silver|gold} [sample]

Both year and day should be left-padded with zeros (ex: 2024 03). Specify sample to run with the small example given in the subject.

Discovering new solutions

When adding a solution (i.e. a internal/{year}-{day}.go file), you can run the discover tool to modify your cmd/solver.go to discover it:

go build -o bin ./tools/discover
./bin/discover

Initializing a new solution

You can also use the discover tool to initialize a new solution:

./bin/discover 2024 01
# creates internal/2024-01/main.go,t then updates cmd/solver.go

Updating badges

You can update the badges in the readme with the following tool:

go build -o bin ./tools/updateBadges
./bin/updateBadges
# follow the instructions

About

Advent of code solutions in Go.

Topics

Resources

License

Stars

Watchers

Forks

Languages