Beispiel #1
0
        public static void TestAll()
        {
            // Day 8: properly grouped:
            // 01100 11110 01100 00110 01100
            // 10010 00010 10010 00010 10010
            // 10010 00100 10000 00010 10000
            // 11110 01000 10000 00010 10000
            // 10010 10000 10010 10010 10010
            // 10010 11110 01100 01100 01100
            // Looks like "AZCJC" which is the correct answer

            var day8Expected = "011001111001100001100110010010000101001000010100101001000100100000001010000111100100010000000101000010010100001001010010100101001011110011000110001100";

            try
            {
                Console.WriteLine("Running tests for 2019");
                Verifier.Verify(3339288, Day01.Part1(), "day 1 part 1");
                Verifier.Verify(5006064, Day01.Part2(), "day 1 part 2");
                Verifier.Verify(2692315, Day02.Part1(), "day 2 part 1");
                Verifier.Verify(9507, Day02.Part2(), "day 2 part 2");
                Verifier.Verify(489, Day03.Part1(), "day 3 part 1");
                Verifier.Verify(93654, Day03.Part2(), "day 3 part 2");
                Verifier.Verify(1675, Day04.Part1(), "day 4 part 1");
                Verifier.Verify(1142, Day04.Part2(), "day 4 part 2");
                Verifier.Verify(4601506, Day05.Part1(), "day 5 part 1");
                Verifier.Verify(5525561, Day05.Part2(), "day 5 part 2");
                Verifier.Verify(110190, Day06.Part1(), "day 6 part 1");
                Verifier.Verify(343, Day06.Part2(), "day 6 part 2");
                Verifier.Verify(422858, Day07.Part1(), "day 7 part 1");
                Verifier.Verify(14897241, Day07.Part2(), "day 7 part 2");
                Verifier.Verify(2440, Day08.Part1(), "day 8 part 1");
                Verifier.Verify(day8Expected, Day08.Part2(), "day 8 part 2");
                Verifier.Verify(3598076521, Day09.Part1(), "day 9 part 1");
                Verifier.Verify(90722, Day09.Part2(), "day 9 part 2");
                Verifier.Verify(286, Day10.Part1(), "day 10 part 1");
                Verifier.Verify(504, Day10.Part2(), "day 10 part 2");
                Verifier.Verify(2255, Day11.Part1(), "day 11 part 1");
                Verifier.Verify("BCKFPCRA", Day11.Part2(), "day 11 part 2");
                Verifier.Verify(12466, Day12.Part1(), "day 12 part 1");
                Verifier.Verify(360689156787864, Day12.Part2(), "day 12 part 2");
                Verifier.Verify(361, Day13.Part1(), "day 13 part 1");
                Verifier.Verify(17590, Day13.Part2(), "day 13 part 2");
                Verifier.Verify(378929, Day14.Part1(), "day 14 part 1");
                Verifier.Verify(3445249, Day14.Part2(), "day 14 part 2");
                Verifier.Verify(216, Day15.Part1(), "day 15 part 1");
                Verifier.Verify(326, Day15.Part2(), "day 15 part 2");
                Verifier.Verify("50053207", Day16.Part1(), "day 16 part 1");
                Verifier.Verify(32749588, Day16.Part2(), "day 16 part 2");
                Verifier.Verify(7328, Day17.Part1(), "day 17 part 1");
                Verifier.Verify(1289413, Day17.Part2(), "day 17 part 2");
                Console.WriteLine("All tests for 2019 OK");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Beispiel #2
0
        public void Day03Part2()
        {
            List<Claim> claimList = new List<Claim>();
            ReadFile(TestInputFileFromDay(3), line =>
            {
                Regex pattern = new Regex(@"#([0-9]+) @ ([0-9]+),([0-9]+): ([0-9]+)x([0-9]+)");
                MatchCollection matches = pattern.Matches(line);
                foreach (Match thisMatch in matches)
                {
                    int id = int.Parse(thisMatch.Groups[1].Value);
                    int left = int.Parse(thisMatch.Groups[2].Value);
                    int top = int.Parse(thisMatch.Groups[3].Value);
                    int width = int.Parse(thisMatch.Groups[4].Value);
                    int height = int.Parse(thisMatch.Groups[5].Value);

                    claimList.Add(new Claim(id, left, top, width, height));
                }
            });
            var result = Day03.Part2(claimList);
            Assert.Equal(1270, result);
        }
Beispiel #3
0
 public static void TestAll()
 {
     try
     {
         Console.WriteLine("Running tests for 2015");
         Verifier.Verify(138, Day01.Part1(0), "day 1 part 1");
         Verifier.Verify(1771, Day01.Part2(0), "day 1 part 2");
         Verifier.Verify(1598415, Day02.Part1(0), "day 2 part 1");
         Verifier.Verify(3812909, Day02.Part2(0), "day 2 part 2");
         Verifier.Verify(2565, Day03.Part1(0), "day 3 part 1");
         Verifier.Verify(2639, Day03.Part2(0), "day 3 part 2");
         Verifier.Verify(282749, Day04.Part1(0), "day 4 part 1");
         Verifier.Verify(9962624, Day04.Part2(0), "day 4 part 2");
         Verifier.Verify(569999, Day06.Part1(), "day 6 part 1");
         Verifier.Verify(17836115, Day06.Part2(), "day 6 part 2");
         Verifier.Verify(3176, Day07.Part1(), "day 7 part 1");
         Console.WriteLine("All tests for 2015 OK");
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
 }
Beispiel #4
0
 public static void TestAll()
 {
     try
     {
         Console.WriteLine("Running tests for 2018");
         Verifier.Verify(435, Day01.Part1(), "day 1 part 1");
         Verifier.Verify(245, Day01.Part2(), "day 1 part 2");
         Verifier.Verify(6448, Day02.Part1(), "day 2 part 1");
         Verifier.Verify(0, Day02.Part2(), "day 2 part 1");
         Verifier.Verify(0, Day03.Part1(), "day 3 part 1");
         Verifier.Verify(0, Day03.Part2(), "day 3 part 2");
         Verifier.Verify(0, Day04.Part1(), "day 4 part 1");
         Verifier.Verify(0, Day04.Part2(), "day 4 part 2");
         Verifier.Verify(0, Day05.Part1(), "day 5 part 1");
         Verifier.Verify(0, Day05.Part2(), "day 5 part 2");
         Verifier.Verify(0, Day06.Part1(), "day 6 part 1");
         Verifier.Verify(0, Day06.Part2(), "day 6 part 2");
         Verifier.Verify(0, Day07.Part1(), "day 7 part 1");
         Verifier.Verify(0, Day07.Part2(), "day 7 part 2");
         Verifier.Verify(0, Day08.Part1(), "day 8 part 1");
         Verifier.Verify(0, Day08.Part2(), "day 8 part 2");
         Verifier.Verify(0, Day09.Part1(), "day 9 part 1");
         Verifier.Verify(0, Day09.Part2(), "day 9 part 2");
         Verifier.Verify(0, Day10.Part1(), "day 10 part 1");
         Verifier.Verify(0, Day10.Part2(), "day 10 part 2");
         Verifier.Verify(0, Day11.Part1(), "day 11 part 1");
         Verifier.Verify(0, Day11.Part2(), "day 11 part 2");
         Verifier.Verify(0, Day12.Part1(), "day 12 part 1");
         Verifier.Verify(0, Day12.Part2(), "day 12 part 2");
         Verifier.Verify(0, Day13.Part1(), "day 13 part 1");
         Verifier.Verify(0, Day13.Part2(), "day 13 part 2");
         Verifier.Verify(0, Day14.Part1(), "day 14 part 1");
         Verifier.Verify(0, Day14.Part2(), "day 14 part 2");
         Verifier.Verify(0, Day15.Part1(), "day 15 part 1");
         Verifier.Verify(0, Day15.Part2(), "day 15 part 2");
         Verifier.Verify(0, Day16.Part1(), "day 16 part 1");
         Verifier.Verify(0, Day16.Part2(), "day 16 part 2");
         Verifier.Verify(0, Day17.Part1(), "day 17 part 1");
         Verifier.Verify(0, Day17.Part2(), "day 17 part 2");
         Verifier.Verify(0, Day18.Part1(), "day 18 part 1");
         Verifier.Verify(0, Day18.Part2(), "day 18 part 2");
         Verifier.Verify(0, Day19.Part1(), "day 19 part 1");
         Verifier.Verify(0, Day19.Part2(), "day 19 part 2");
         Verifier.Verify(0, Day20.Part1(), "day 20 part 1");
         Verifier.Verify(0, Day20.Part2(), "day 20 part 2");
         Verifier.Verify(0, Day21.Part1(), "day 21 part 1");
         Verifier.Verify(0, Day21.Part2(), "day 21 part 2");
         Verifier.Verify(0, Day22.Part1(), "day 22 part 1");
         Verifier.Verify(0, Day22.Part2(), "day 22 part 2");
         Verifier.Verify(0, Day23.Part1(), "day 23 part 1");
         Verifier.Verify(0, Day23.Part2(), "day 23 part 2");
         Verifier.Verify(0, Day24.Part1(), "day 24 part 1");
         Verifier.Verify(0, Day24.Part2(), "day 24 part 2");
         Verifier.Verify(0, Day25.Part1(), "day 25 part 1");
         Console.WriteLine("All tests for 2018 OK");
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
 }
Beispiel #5
0
 public static void TestAll()
 {
     try
     {
         Console.WriteLine("Running tests for 2020");
         Verifier.Verify(55776, Day01.Part1(0), "day 1 part 1");
         Verifier.Verify(223162626, Day01.Part2(0), "day 1 part 2");
         Verifier.Verify(622, Day02.Part1(0), "day 2 part 1");
         Verifier.Verify(263, Day02.Part2(0), "day 2 part 1");
         Verifier.Verify(159, Day03.Part1(0), "day 3 part 1");
         Verifier.Verify(6419669520, Day03.Part2(0), "day 3 part 2");
         Verifier.Verify(210, Day04.Part1(0), "day 4 part 1");
         Verifier.Verify(131, Day04.Part2(0), "day 4 part 2");
         Verifier.Verify(894, Day05.Part1(0), "day 5 part 1");
         Verifier.Verify(579, Day05.Part2(0), "day 5 part 2");
         Verifier.Verify(6530, Day06.Part1(0), "day 6 part 1");
         Verifier.Verify(3323, Day06.Part2(0), "day 6 part 2");
         Verifier.Verify(192, Day07.Part1(0), "day 7 part 1");
         Verifier.Verify(12128, Day07.Part2(0), "day 7 part 2");
         Verifier.Verify(1671, Day08.Part1(0), "day 8 part 1");
         Verifier.Verify(892, Day08.Part2(0), "day 8 part 2");
         Verifier.Verify(70639851, Day09.Part1(0), "day 9 part 1");
         Verifier.Verify(8249240, Day09.Part2(0), "day 9 part 2");
         Verifier.Verify(2450, Day10.Part1(0), "day 10 part 1");
         Verifier.Verify(32396521357312, Day10.Part2(0), "day 10 part 2");
         Verifier.Verify(2273, Day11.Part1(0), "day 11 part 1");
         Verifier.Verify(2064, Day11.Part2(0), "day 11 part 2");
         Verifier.Verify(1710, Day12.Part1(0), "day 12 part 1");
         Verifier.Verify(62045, Day12.Part2(0), "day 12 part 2");
         Verifier.Verify(119, Day13.Part1(), "day 13 part 1");
         Verifier.Verify(1106724616194525, Day13.Part2(), "day 13 part 2");
         Verifier.Verify(5875750429995, Day14.Part1(0), "day 14 part 1");
         Verifier.Verify(5272149590143, Day14.Part2(0), "day 14 part 2");
         Verifier.Verify(959, Day15.Part1(0), "day 15 part 1");
         Verifier.Verify(116590, Day15.Part2(0), "day 15 part 2");
         Verifier.Verify(25972, Day16.Part1(0), "day 16 part 1");
         Verifier.Verify(622670335901, Day16.Part2(0), "day 16 part 2");
         Verifier.Verify(353, Day17.Part1(0), "day 17 part 1");
         Verifier.Verify(2472, Day17.Part2(0), "day 17 part 2");
         Verifier.Verify(11076907812171, Day18.Part1(), "day 18 part 1");
         Verifier.Verify(283729053022731, Day18.Part2(), "day 18 part 2");
         Verifier.Verify(149, Day19.Part1(), "day 19 part 1");
         Verifier.Verify(332, Day19.Part2(), "day 19 part 2");
         Verifier.Verify(83775126454273, Day20.Part1(), "day 20 part 1");
         Verifier.Verify(1993, Day20.Part2(), "day 20 part 2");
         Verifier.Verify(2659, Day21.Part1(), "day 21 part 1");
         Verifier.Verify("rcqb,cltx,nrl,qjvvcvz,tsqpn,xhnk,tfqsb,zqzmzl", Day21.Part2(), "day 21 part 2");
         Verifier.Verify(31781, Day22.Part1(), "day 22 part 1");
         Verifier.Verify(35154, Day22.Part2(), "day 22 part 2");
         Verifier.Verify(75893264, Day23.Part1(), "day 23 part 1");
         Verifier.Verify(38162588308, Day23.Part2(), "day 23 part 2");
         Verifier.Verify(228, Day24.Part1(), "day 24 part 1");
         Verifier.Verify(3672, Day24.Part2(), "day 24 part 2");
         Verifier.Verify(181800, Day25.Part1(), "day 25 part 1");
         Console.WriteLine("All tests for 2020 OK");
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
 }
Beispiel #6
0
 public static void TestAll()
 {
     try
     {
         Console.WriteLine("Running tests for 2021");
         Verifier.Verify(1529, Day01.Part1(), "day 1 part 1");
         Verifier.Verify(1567, Day01.Part2(), "day 1 part 2");
         Verifier.Verify(1813801, Day02.Part1(), "day 2 part 1");
         Verifier.Verify(1960569556, Day02.Part2(), "day 2 part 1");
         Verifier.Verify(2724524, Day03.Part1(), "day 3 part 1");
         Verifier.Verify(2775870, Day03.Part2(), "day 3 part 2");
         Verifier.Verify(44736, Day04.Part1(), "day 4 part 1");
         Verifier.Verify(1827, Day04.Part2(), "day 4 part 2");
         Verifier.Verify(4728, Day05.Part1(), "day 5 part 1");
         Verifier.Verify(17717, Day05.Part2(), "day 5 part 2");
         Verifier.Verify(375482, Day06.Part1(), "day 6 part 1");
         Verifier.Verify(1689540415957, Day06.Part2(), "day 6 part 2");
         Verifier.Verify(356922, Day07.Part1(), "day 7 part 1");
         Verifier.Verify(100347031, Day07.Part2(), "day 7 part 2");
         Verifier.Verify(488, Day08.Part1(), "day 8 part 1");
         Verifier.Verify(1040429, Day08.Part2(), "day 8 part 2");
         Verifier.Verify(496, Day09.Part1(), "day 9 part 1");
         Verifier.Verify(902880, Day09.Part2(), "day 9 part 2");
         Verifier.Verify(294195, Day10.Part1(), "day 10 part 1");
         Verifier.Verify(3490802734, Day10.Part2(), "day 10 part 2");
         Verifier.Verify(1725, Day11.Part1(), "day 11 part 1");
         Verifier.Verify(308, Day11.Part2(), "day 11 part 2");
         Verifier.Verify(4338, Day12.Part1(), "day 12 part 1");
         Verifier.Verify(114189, Day12.Part2(), "day 12 part 2");
         Verifier.Verify(0, Day13.Part1(), "day 13 part 1");
         Verifier.Verify(0, Day13.Part2(), "day 13 part 2");
         Verifier.Verify(0, Day14.Part1(), "day 14 part 1");
         Verifier.Verify(0, Day14.Part2(), "day 14 part 2");
         Verifier.Verify(0, Day15.Part1(), "day 15 part 1");
         Verifier.Verify(0, Day15.Part2(), "day 15 part 2");
         Verifier.Verify(0, Day16.Part1(), "day 16 part 1");
         Verifier.Verify(0, Day16.Part2(), "day 16 part 2");
         Verifier.Verify(0, Day17.Part1(), "day 17 part 1");
         Verifier.Verify(0, Day17.Part2(), "day 17 part 2");
         Verifier.Verify(0, Day18.Part1(), "day 18 part 1");
         Verifier.Verify(0, Day18.Part2(), "day 18 part 2");
         Verifier.Verify(0, Day19.Part1(), "day 19 part 1");
         Verifier.Verify(0, Day19.Part2(), "day 19 part 2");
         Verifier.Verify(0, Day20.Part1(), "day 20 part 1");
         Verifier.Verify(0, Day20.Part2(), "day 20 part 2");
         Verifier.Verify(0, Day21.Part1(), "day 21 part 1");
         Verifier.Verify(0, Day21.Part2(), "day 21 part 2");
         Verifier.Verify(0, Day22.Part1(), "day 22 part 1");
         Verifier.Verify(0, Day22.Part2(), "day 22 part 2");
         Verifier.Verify(0, Day23.Part1(), "day 23 part 1");
         Verifier.Verify(0, Day23.Part2(), "day 23 part 2");
         Verifier.Verify(0, Day24.Part1(), "day 24 part 1");
         Verifier.Verify(0, Day24.Part2(), "day 24 part 2");
         Verifier.Verify(0, Day25.Part1(), "day 25 part 1");
         Console.WriteLine("All tests for 2021 OK");
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
 }