34 lines
No EOL
1 KiB
C#
34 lines
No EOL
1 KiB
C#
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()}");
|
|
}
|
|
} |