Beispiel #1
0
            public void Should_play_bingo()
            {
                var draws  = new[] { 7, 4, 9, 5, 11, 17, 23, 2, 0, 14, 21, 24, 10, 16, 13, 6, 15, 25, 12, 22, 18, 20, 8, 19, 3, 26, 1 };
                var boards = new[]
                {
                    22, 13, 17, 11, 0,
                    8, 2, 23, 4, 24,
                    21, 9, 14, 16, 7,
                    6, 10, 3, 18, 5,
                    1, 12, 20, 15, 19,

                    3, 15, 0, 2, 22,
                    9, 18, 13, 17, 5,
                    19, 8, 7, 25, 23,
                    20, 11, 10, 24, 4,
                    14, 21, 16, 12, 6,

                    14, 21, 17, 24, 4,
                    10, 16, 15, 9, 19,
                    18, 8, 23, 26, 20,
                    22, 11, 13, 6, 5,
                    2, 0, 12, 3, 7
                };
                var target = new Day4();

                var result = target.Execute(draws, boards);

                result.Should().Be(4512);
            }
Beispiel #2
0
            public void Should_solve()
            {
                var target = new Day4();

                var result = target.Execute(draws, boards);

                output.WriteLine(result.ToString());
            }
Beispiel #3
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);
        }