Пример #1
0
        public override void Execute()
        {
            string sample = "";

            if (_options.Sample)
            {
                sample = "-sample";
            }

            string filename = Path.Combine(Environment.CurrentDirectory, "..", "AdventOfCode.2019", "input", $"day{_options.Day.ToString("D2")}{sample}.txt");

            switch (_options.Day)
            {
            case 1:
                Day01.Execute(filename);
                break;

            case 2:
                Day02.Execute(filename);
                break;

            case 3:
                Day03.Execute(filename);
                break;

            case 4:
                Day04.Execute(filename);
                break;

            case 5:
                Day05.Execute(filename);
                break;

            case 6:
                Day06.Execute(filename);
                break;

            case 7:
                Day07.Execute(filename);
                break;

            case 8:
                Day08.Execute(filename);
                break;

            case 9:
                Day09.Execute(filename);
                break;

            case 10:
                Day10.Execute(filename);
                break;

            case 11:
                Day11.Execute(filename);
                break;

            case 12:
                Day12.Execute(filename);
                break;

            case 13:
                Day13.Execute(filename);
                break;

            case 14:
                Day14.Execute(filename);
                break;

            case 15:
                Day15.Execute(filename);
                break;

            case 16:
                Day16.Execute(filename);
                break;

            case 17:
                Day17.Execute(filename);
                break;

            case 18:
                Day18.Execute(filename);
                break;

            case 19:
                Day19.Execute(filename);
                break;

            case 20:
                Day20.Execute(filename);
                break;

            case 21:
                Day21.Execute(filename);
                break;

            case 22:
                Day22.Execute(filename);
                break;

            case 23:
                Day23.Execute(filename);
                break;

            case 24:
                Day24.Execute(filename);
                break;

            case 25:
                Day25.Execute(filename);
                break;

            default:
                throw new ArgumentException($"Day {_options.Day} is outside the scope of Advent of Code.", "--day");
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            bool confirmed = false;

            do
            {
                Console.WriteLine("Welcome to HackerRank's 30 Days of Code");
                Console.WriteLine("Days");
                for (int i = 0; i < dias.Length; i++)
                {
                    Console.WriteLine(dias[i]);
                }
                Console.WriteLine("Write the day number to be executed: ");
                int opt = Convert.ToInt32(Console.ReadLine());
                switch (opt)
                {
                case 1:
                    Day1.Execute();
                    break;

                case 2:
                    Day2.Execute();
                    break;

                case 3:
                    Day3.Execute();
                    break;

                case 4:
                    Day4.Execute();
                    break;

                case 5:
                    Day5.Execute();
                    break;

                case 6:
                    Day6.Execute();
                    break;

                case 7:
                    Day7.Execute();
                    break;

                case 8:
                    Day8.Execute();
                    break;

                case 9:
                    Day9.Execute();
                    break;

                case 10:
                    Day10.Execute();
                    break;

                case 11:
                    Day11.Execute();
                    break;

                case 12:
                    Day12.Execute();
                    break;

                case 13:
                    Day13.Execute();
                    break;

                case 14:
                    Day14.Execute();
                    break;

                case 15:
                    Day15.Execute();
                    break;

                case 16:
                    Day16.Execute();
                    break;

                case 17:
                    Day17.Execute();
                    break;

                case 18:
                    Day18.Execute();
                    break;

                case 19:
                    Day19.Execute();
                    break;

                case 20:
                    Day20.Execute();
                    break;

                case 21:
                    Day21.Execute();
                    break;

                case 22:
                    Day22.Execute();
                    break;

                case 23:
                    Day23.Execute();
                    break;

                case 24:
                    Day24.Execute();
                    break;

                case 25:
                    Day25.Execute();
                    break;

                case 26:
                    Day26.Execute();
                    break;

                case 27:
                    Day27.Execute();
                    break;

                case 28:
                    Day28.Execute();
                    break;

                case 29:
                    Day29.Execute();
                    break;

                default:
                    Console.WriteLine("Not Implemeted");
                    break;
                }
                ConsoleKey response;
                do
                {
                    Console.Write("Execute another function? (Y/N) ");
                    response = Console.ReadKey(false).Key;
                    if (response != ConsoleKey.Enter)
                    {
                        Console.WriteLine();
                    }
                }while(response != ConsoleKey.Y && response != ConsoleKey.N);
                confirmed = response == ConsoleKey.N;
            }while(!confirmed);
        }