示例#1
0
 static void Main(string[] args)
 {
     Console.WriteLine("Hello World!");
     Day1.Solve();
     Day2.Solve();
     Day3.Solve();
     Console.Read();
 }
示例#2
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()}");
 }
        public static void SafeSolve(string input)
        {
            try
            {
                if (ValidateInput(input))
                {
                    Console.WriteLine($"Solving day {SafeGetDay(input)}, part {SafeGetPart(input)}");
                    switch (input)
                    {
                    case "1.1":
                        Day1.Solve("Data/D1P1.txt");
                        break;

                    case "1.2":
                        Day1.Solve("Data/D1P1.txt", true);
                        break;

                    case "2.1":
                        Day2.Solve("Data/D2P1.txt");
                        break;

                    case "2.2":
                        Day2.Solve("Data/D2P1.txt", true);
                        break;

                    case "3.1":
                        Day3.Solve("Data/D3P1.txt", true);
                        break;

                    case "4.1":
                        Day4.Solve("Data/D4P1.txt");
                        break;

                    case "4.2":
                        Day4.Solve("Data/D4P1.txt", true);
                        break;

                    case "5.1":
                        Day5.Solve("Data/D5P1.txt");
                        break;

                    case "5.2":
                        Day5.Solve("Data/D5P1.txt", true);
                        break;

                    case "7.1":
                        Day7.Solve("Data/D7P1.txt");
                        break;

                    case "7.2":
                        Day7.Solve("Data/D7P1.txt", true);
                        break;

                    default:
                        Console.WriteLine("No puzzle found for specified date. Try again.");
                        break;
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine($"We done goofed on day {SafeGetDay(input)}. " + e.Message);
            }
        }
        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}");
        }