public void Initialize() { string className = this.GetType().Name; string dayName = className.Replace("Test", ""); var t = GetDayType(dayName); Puzzle = Activator.CreateInstance(t) as AdventPuzzle; }
static void Main(string[] args) { int day = 25; string dayName = $"Day{day:00}"; string puzzleClassName = $"{typeof(Program).Namespace}.{dayName}"; Type t = Type.GetType(puzzleClassName); AdventPuzzle puzzle = Activator.CreateInstance(t) as AdventPuzzle; puzzle.Input.LoadFromFile(Path.Combine(inputPath, $"{dayName}.txt")); puzzle.ParseInput(); puzzle.Solve(Puzzle.Both); }