Skip to content

Latest commit

 

History

History
113 lines (77 loc) · 33.8 KB

README.md

File metadata and controls

113 lines (77 loc) · 33.8 KB

Advent of Code

This repo contains my solutions to the Advent of Code puzzles.

Solution format

<year>
 └───<day>
     ├───leaderboard
     │   ├───1
     │   └───2
     └───optimized
         ├───1
         └───2
Directory Meaning
year Holds solutions for all puzzles in that year.
day Holds solutions for all puzzles on that day.
leaderboard A quick attempt at the puzzle to try to get onto the leaderboards.
optimized The end result of optimizing the solution. Primarily for readability, secondarily for time/space complexity.
1 Solution to the first part of the puzzle.
2 Solution to the second part of the puzzle.

Notes

Running

The working directory needs to be the root folder of the repository, i.e. AdventOfCode, to run both solutions and scripts.

Organization

Each day is partitioned into leaderboard and optimized solutions. The optimized solution usually builds on top of the leaderboard solution.

Each part of each solution is partitioned into its own folder, where only that part is solved.

Scripts

Generating new solution directories

go run cmd/template/main.go without arguments (or make template) will infer which directory to generate by looking at the last completed puzzle and generating the next one. E.g. if 2021/5/leaderboard exists, it'll generate 2021/5/optimized. Once that exists, it'll generate 2021/6/leaderboard, and so on.

When inferring arguments, solutions to skip can be specified through skip.txt. Each line is of the format year/day # optional comment, and if day is omitted the entire year is skipped. year or day can either be a single number num, or a range like num-num to exclude multiple values.

The arguments can be provided through the command line as well. See go run cmd/template/main.go --help for argument info.

Updating the completion tables

go run cmd/readme/main.go (or make readme) will update the completion tables below based on the directory structure of the repository. It takes no arguments.

Doing both

make will infer a new day, create it, and then update the readme.

Running tests

make test will run tests on the command scripts.

Completion

2023

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
leaderboard 1,2 1,2 1,2 1,2 1,2
optimized 1,2 1,2 1,2 1,2

2022

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
leaderboard 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1
optimized 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2

2021

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
leaderboard 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1
optimized 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1

2020

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
leaderboard 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1
optimized 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1 1 1,2 1

2019

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
leaderboard 1,2 1,2 1,2 1,2
optimized 1,2 2 2 2

2016

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
leaderboard 1,2
optimized

2015

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
leaderboard 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2 1,2
optimized