This repository contains my solutions for the Advent of Code challenges. Each year and day have their respective directories with C# solution classes. The solutions are organized using the following structure:
/Year
/Day01
- Input.txt # Real puzzle input
- SampleInput.txt # Sample from problem description
- Expected.json # Expected answers for sample input
- SolutionClass01.cs
/Day02
- Input.txt
- SampleInput.txt
- Expected.json
- SolutionClass02.cs
...
Run the interactive setup script:
./add_solution.sh 2025 1 SecretEntranceYou'll be prompted to paste:
- Sample input from the problem
- Expected answers (Part 1 & Part 2)
- Real puzzle input
Launch watch mode:
./watch-solution.sh 2025 1This opens a tmux session with:
- Top pane: Your editor (neovim) with the solution file
- Bottom pane: Auto-running tests that show results every time you save
Note: If you're already in tmux, the script will offer you options:
- Option 1: Split current window
- Option 2: Create new window
- Option 3: Just run watch mode
Every time you save your code, you'll instantly see:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🎄 Advent of Code 2025 Day 1
Watching for changes...
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✓ Part 1: 142 ✓ (12ms)
✓ Part 2: 281 ✓ (8ms)
Last run: 14:23:45
Once sample tests pass, get your real answers:
- In the bottom pane: Press
Ctrl+Cto stop watching - Run:
dotnet run solve -y 2025 -d 1 - Copy the output to Advent of Code website
./add_solution.sh <year> <day> <solution_name>Creates solution files and prompts for inputs.
./watch-solution.sh <year> <day>Opens tmux with live feedback on sample input.
dotnet run solve-sample -y <year> -d <day>One-shot test against sample input with validation.
dotnet run solve -y <year> -d <day>Run solution against real puzzle input.
dotnet run allRun all solutions in the repository.
Solutions implement the Execute() method:
public override SolutionResult Execute(string input)
{
// Parse input
var lines = input.Split(['\r', '\n'], StringSplitOptions.RemoveEmptyEntries);
// Your solution logic here
return new SolutionResult
{
Part1 = "answer1",
Part2 = "answer2"
};
}{
"part1": "142",
"part2": "281"
}Leave values empty ("") if you don't know the answer yet:
{
"part1": "142",
"part2": ""
}The 9999/ directory contains test solutions for validating the watch mode system:
# Test sample validation
dotnet run solve-sample -y 9999 -d 1
# Test watch mode
./watch-solution.sh 9999 1See 9999/README.md for more details.
If you're already in a tmux session (common workflow), ./watch-solution.sh will offer options:
- Option 1 (recommended): Splits current window - quick and keeps context
- Option 2: Creates new window - preserves your layout
- Option 3: Just runs watch mode - you open editor manually
If you prefer to set up manually:
# In one pane/terminal:
dotnet run watch -y 2025 -d 1
# In another pane/terminal:
nvim 2025/Day01/YourSolution.csInspiration and challenges provided by Advent of Code.