The inputs for are expected in src/AdventOfCode/Inputs/<DD>.txt
You can use aoc-cli
for this:
mkdir -p src/AdventOfCode/Inputs
for i in $(seq -w 25);do
aoc download -y 2023 -d $i -I -i src/AdventOfCode/Inputs/$i.txt
done
The pipeline will use aoc-cli
to download the necessary input files. For this to work, a session cookie has to be set (and somethimes renewed). This session is read from a GitHub secret ADVENT_OF_CODE_SESSION
. Once this is set to your session cookie, which you can find in your local browser storage when logged in on AdventOfCode.
Advent of Code template based on AoCHelper project.
It allows you to focus on solving AoC puzzles while providing you with some performance stats.
Problem example:
using AoCHelper;
using System.Threading.Tasks;
namespace AdventOfCode;
public class Day_01 : BaseDay
{
public override ValueTask<string> Solve_1() => new("Solution 1");
public override ValueTask<string> Solve_2() => new("Solution 2");
}
Output example:
- Create one class per advent day, following
DayXX
orDay_XX
naming convention and implementingAoCHelper.BaseDay
. - Place input files under
Inputs/
dir, followingXX.txt
convention. - Read the input content from
InputFilePath
and solve the puzzle by implementingSolve_1()
andSolve_2()
!
By default, only your last problem will be solved when running the project. You can change that by behavior by modifying Program.cs
.
Invoking different methods:
-
Solver.SolveAll();
→ solves all the days. -
Solver.SolveLast();
→ solves only the last day. -
Solver.Solve<Day_XX>();
→ solves only dayXX
. -
Solver.Solve(new uint[] { XX, YY });
→ solves only daysXX
andYY
. -
Solver.Solve(new [] { typeof(Day_XX), typeof(Day_YY) });
→ same as above.
Providing a custom Action<SolverConfiguration>
to any of those methods (availabe options described here):
-
Solver.SolveLast(opt => opt.ClearConsole = false);
→ solves only the last day providing a custom configuration. -
Solver.SolveAll(opt => { opt.ShowConstructorElapsedTime = true; opt.ShowTotalElapsedTimePerDay = true; opt.ElapsedTimeFormatSpecifier = "F3"; });
solves all the days providing a custom configuration.
Check AoCHelper README file for detailed information about how to override the default file naming and location conventions of your problem classes and input files.