AdventOfCode

module
v0.0.0-...-7ecd0ca Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 30, 2021 License: GPL-3.0

README

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 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 cmd/template/skip.txt. Each line is of the format year/day/types # optional comment where types is a comma separated list of either l for leaderboard solutions or o for optimized solutions. If no types are provided it defaults to all types for that day, if no day then all days for that year. Comments optional.

The year/day/type can be provided manually 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 and then update the readme.

Completion

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 1,2 1,2 1,2

Directories

Path Synopsis
2019
13
5
9
2020
2021
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL