Exemple #1
0
 static void Main(string[] args)
 {
     Console.WriteLine($"Day 1: {Day1.Solve()}");
     Console.WriteLine($"Day 2: {Day2.Solve()}");
     Console.WriteLine($"Day 3: {Day3.Solve()}");
     Console.WriteLine($"Day 4: {Day4.Solve()}");
     Console.WriteLine($"Day 5: {string.Join(", ", Day5.Solve())}");
     Console.WriteLine($"Day 6: {Day6.Solve()}");
 }
        static void PrintSolution(int day)
        {
            switch (day)
            {
            case 1:
                Console.WriteLine("\nSolving Day 1....");
                Console.WriteLine($"Solution to part 1: {Day1.SolvePart1()}\n");
                Console.WriteLine($"Solution to part 2: {Day1.SolvePart2()}\n");
                break;

            case 2:
                Console.WriteLine("\nSolving Day 2....");
                Console.WriteLine($"Solution to part 1: {Day2.Solve(1)}\n");
                Console.WriteLine($"Solution to part 2: {Day2.Solve(2)}\n");
                break;

            case 3:
                Console.WriteLine("\nSolving Day 3....");
                Console.WriteLine($"Solution to part 1: {Day3.SolvePart1()}\n");
                Console.WriteLine($"Solution to part 2: {Day3.SolvePart2()}\n");
                break;

            case 4:
                Console.WriteLine("\nSolving Day 4....");

                var day4 = new Day4();
                Console.WriteLine($"Solution to part 1: {day4.Solve(1)}\n");

                day4.RefreshInput();
                Console.WriteLine($"Solution to part 2: {day4.Solve(2)}\n");
                break;

            case 5:
                Console.WriteLine("\nSolving Day 5....");

                var day5 = new Day5();
                Console.WriteLine($"Solution to part 1: {day5.Solve()}\n");

                day5.RefreshInput();
                Console.WriteLine($"Solution to part 2: {day5.SolvePart2()}\n");
                break;

            case 6:
                Console.WriteLine("\nSolving Day 6....");

                var day6 = new Day6();
                Console.WriteLine($"Solution to part 1: {day6.Solve()}\n");

                day6.RefreshInput();
                Console.WriteLine($"Solution to part 2: {day6.SolvePart2()}\n");
                break;

            case 7:
                Console.WriteLine("\nSolving Day 7....");

                var day7 = new Day7();
                Console.WriteLine($"Solution to part 1: {day7.Solve()}\n");

                day7.RefreshInput();
                Console.WriteLine($"Solution to part 2: {day7.SolvePart2()}\n");
                break;

            case 99:
                Console.WriteLine("\nDoing custom fun stuff....");

                var quiz = new Quiz();
                Console.WriteLine($"Number of occurrences of \"make it so\" in all of TNG: {quiz.FindInTng("make it so")}");

                quiz = new Quiz();
                Console.WriteLine($"Number of occurrences of \"earl grey\" in all of TNG: {quiz.FindInTng("earl grey")}");

                quiz = new Quiz();
                Console.WriteLine($"Number of occurrences of \"earl grey hot\" in all of TNG: {quiz.FindInTng("earl grey hot")}");

                quiz = new Quiz();
                Console.WriteLine($"Number of occurrences of \"tea earl grey hot\" in all of TNG: {quiz.FindInTng("tea earl grey hot")}");

                quiz = new Quiz();
                Console.WriteLine($"Number of occurrences of \"shut up\" in all of TNG: {quiz.FindInTng("shut up")}");

                quiz = new Quiz();
                Console.WriteLine($"Number of occurrences of \"shut up wesley\" in all of TNG: {quiz.FindInTng("shut up wesley")}");

                break;

            default:
                break;
            }
        }
        public static void Solve(int day, int problemPart)
        {
            var puzzleInput = _loadFileInput(day);
            var solution    = 0;

            switch (day)
            {
            case 1:
                solution = Day1.Solve(puzzleInput, problemPart);
                break;

            case 2:
                solution = Day2.Solve(puzzleInput, problemPart);
                break;

            case 3:
                solution = Day3.Solve(puzzleInput);
                break;

            case 4:
                solution = Day4.Solve(puzzleInput);
                break;

            case 5:
                solution = Day5.Solve(puzzleInput);
                break;

            case 6:
                solution = Day6.Solve(puzzleInput);
                break;

            case 7:
                solution = Day7.Solve(puzzleInput);
                break;

            case 8:
                solution = Day8.Solve(puzzleInput);
                break;

            case 9:
                throw new NotImplementedException();
                break;

            case 10:
                throw new NotImplementedException();
                break;

            case 11:
                throw new NotImplementedException();
                break;

            case 12:
                throw new NotImplementedException();
                break;

            case 13:
                throw new NotImplementedException();
                break;

            case 14:
                throw new NotImplementedException();
                break;

            case 15:
                throw new NotImplementedException();
                break;

            case 16:
                throw new NotImplementedException();
                break;

            case 17:
                throw new NotImplementedException();
                break;

            case 18:
                throw new NotImplementedException();
                break;

            case 19:
                throw new NotImplementedException();
                break;

            case 20:
                throw new NotImplementedException();
                break;

            case 21:
                throw new NotImplementedException();
                break;

            case 22:
                throw new NotImplementedException();
                break;

            case 23:
                throw new NotImplementedException();
                break;

            case 24:
                throw new NotImplementedException();
                break;

            case 25:
                throw new NotImplementedException();
                break;

            default:
                Console.WriteLine("ERROR: Inavlid day");
                break;
            }

            Console.WriteLine($"Puzzle Solution: {solution}");
        }