feat: Add day 1
This commit is contained in:
parent
319a02e0fd
commit
8e8ca67091
8 changed files with 4594 additions and 0 deletions
34
AdventOfCode2026/Program.cs
Normal file
34
AdventOfCode2026/Program.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
namespace AdventOfCode2026;
|
||||
|
||||
internal class Program
|
||||
{
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
const int numberOfDays = 12;
|
||||
foreach (var day in Enumerable.Range(1, numberOfDays))
|
||||
{
|
||||
RunDay(day);
|
||||
}
|
||||
}
|
||||
|
||||
private static void RunDay(int day)
|
||||
{
|
||||
var solutionText = $"Solution for Day {day.ToString().PadLeft(2, '0')}:";
|
||||
var className = $"Day{day}";
|
||||
var classType = Type.GetType($"AdventOfCode2026.{className}");
|
||||
if (classType == null)
|
||||
{
|
||||
Console.WriteLine($"{solutionText} is not implemented.");
|
||||
return;
|
||||
}
|
||||
var instance = Activator.CreateInstance(classType);
|
||||
if (instance is not Solution solution)
|
||||
{
|
||||
throw new NotImplementedException($"{classType} is not implemented.");
|
||||
}
|
||||
|
||||
Console.WriteLine($"{solutionText}");
|
||||
Console.WriteLine($"\tPart 1: {solution.SolvePart1()}");
|
||||
Console.WriteLine($"\tPart 2: {solution.SolvePart2()}");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue