This repository contains solutions to Advent of Code problems, organized by year. Each year typically has its own directory, and within those directories, solutions may be implemented in various programming languages.
YYYY/: Directories for each Advent of Code year (e.g.,2015/,2022/).YYYY/<language>/: Within each year, there might be subdirectories for different programming languages used for solutions (e.g.,2024/golang/,2022/src/).YYYY/<day>/orYYYY/src/_<day>/: Individual problem solutions are often found within day-specific directories or files.inputs/: Some years include aninputsdirectory for problem input data.
The repository currently contains solutions implemented in:
- Rust (e.g.,
2022/,2021/_7/Cargo.toml) - C# (e.g.,
2021/cs/1/1.csproj) - Go (e.g.,
2024/golang/go.mod,2019/go/go.mod) - TypeScript (e.g.,
2021/_7/index.ts) - Zig (e.g.,
2024/zig/.gitignore)
Due to the polyglot nature of this repository, build and test commands are specific to each language and year.
For Rust projects (identified by Cargo.toml), you might need libclang development headers installed on your system for some dependencies.
- Build:
cargo build - Run:
cargo run - Test:
cargo test
Example (for 2022 solutions):
cd 2022
cargo run --bin _1 -- input.data
cargo testFor Go projects (identified by go.mod):
- Run:
go run .orgo run main.go(ifmain.goexists) - Test:
go test ./...
Example (for 2024 Go solutions):
cd 2024/golang
go run .
go test ./...For C# projects (identified by .csproj and .sln files):
- Build:
dotnet build - Run:
dotnet run(from the project directory containing the.csproj) - Test:
dotnet test
Example (for 2021 C# solutions, day 1):
cd 2021/cs/1
dotnet runTypeScript projects typically use npm or yarn. Look for package.json to identify scripts.
- Install dependencies:
npm installoryarn install - Run:
npm startoryarn start(or a specific script defined inpackage.json) - Test:
npm testoryarn test
Example (for 2021 _7 TypeScript solution):
cd 2021/_7
# Assuming package.json with a start script
npm install
npm start- Input Data: Input files are often named
input.dataorinput.txtand sometimesinput.exampleorinput.testfor smaller test cases. - Solution Structure: Solutions often reside in files or directories named after the day (e.g.,
_1.rs,_5/mod.rs,Program.cs). - Modules/Packages: Projects generally follow standard language-specific module/package conventions.
- File Naming: Day-specific solutions often use
_DAYprefix (e.g.,_1.rs,_5/). - Input Files:
input.data,input.example,input.test.
- Test Data: Small test cases are often stored in files like
input.testorinput.example. - Language-Specific Testing: Testing follows the conventions of the respective language (e.g.,
cargo testfor Rust,go testfor Go,dotnet testfor C#).
- Polyglot Nature: Be aware that solutions for different years, or even different days within the same year, might be implemented in entirely different languages. Always check for language-specific configuration files (
Cargo.toml,go.mod,.csproj,package.json) to determine the context. - Input Pathing: Solutions often expect input files to be in a specific relative path, typically in an
inputsdirectory or directly alongside the solution file.