public void Should_count_route_permutations()
        {
            var _inputReader  = new InputReaders();
            var path          = @"C:\Users\emollett\Documents\sites\AdventOfCode2020\AdventOfCode2020\Inputs\10_AdapterArray_Test.txt";
            var adapters      = _inputReader.readLongNumbers(path);
            var _adapterArray = new AdapterArray(adapters);

            Assert.Equal(19208, _adapterArray.countRoutes());
        }
        public void Should_count_route_permutations_small_example()
        {
            var adapters = new List <long> {
                16, 10, 15, 5, 1, 11, 7, 19, 6, 12, 4
            };
            var _adapterArray = new AdapterArray(adapters);

            Assert.Equal(8, _adapterArray.countRoutes());
        }
        public void Should_count_adaptor_differences()
        {
            var _inputReader  = new InputReaders();
            var path          = @"C:\Users\emollett\Documents\sites\AdventOfCode2020\AdventOfCode2020\Inputs\10_AdapterArray_Test.txt";
            var adapters      = _inputReader.readLongNumbers(path);
            var _adapterArray = new AdapterArray(adapters);

            Assert.Equal(220, _adapterArray.countAdapters());
        }
        public void Should_count_adapter_differences_small_example()
        {
            var adapters = new List <long> {
                16, 10, 15, 5, 1, 11, 7, 19, 6, 12, 4
            };
            var _adapterArray = new AdapterArray(adapters);

            Assert.Equal(35, _adapterArray.countAdapters());
        }
Пример #5
0
        public void ExamplePartTwoRecurssion(string[] input, int expected)
        {
            // Arrange
            var adapter = new AdapterArray(input);

            // Act
            var result = adapter.CalculateArrangements();

            // Assert
            Assert.AreEqual(expected, result);
        }
Пример #6
0
        public void ExamplePartOne(string[] input, int expected)
        {
            // Arrange
            var adapter = new AdapterArray(input);

            // Act
            var result = adapter.CalculateJoltsDifference();

            // Assert
            Assert.AreEqual(expected, result);
        }
Пример #7
0
Файл: Day10.cs Проект: stefc/AoC
        public void PuzzlePartTwo()
        {
            //  Arrange
            var input = File
                        .ReadLines("tests/y2020/Day10.Input.txt")
                        .Select(x => Convert.ToInt32(x));

            // Act
            var actual = AdapterArray.CountUnique(input);

            // Assert
            Assert.Equal(2107417088L, actual);
        }
Пример #8
0
Файл: Day10.cs Проект: stefc/AoC
        public void PuzzlePartOne()
        {
            //  Arrange
            var input = File
                        .ReadLines("tests/y2020/Day10.Input.txt")
                        .Select(x => Convert.ToInt32(x));

            // Act
            var actual = AdapterArray.CountJolt(input);

            // Assert
            Assert.Equal(1998, actual);
        }
Пример #9
0
Файл: Day10.cs Проект: stefc/AoC
        public void PuzzleOne()
        {
            // Arrange
            var input = new int[] {
                16, 10, 15, 5, 1, 11, 7, 19, 6, 12, 4
            };

            // Act
            var actual = AdapterArray.CountJolt(input);

            // Assert
            Assert.Equal(5 * 7, actual);
        }
Пример #10
0
Файл: Day10.cs Проект: stefc/AoC
        public void PuzzleTwo()
        {
            // Arrange
            var input = new int[] {
                // 16,10,15,5,1,11,7,19,6,12,4

                28, 33, 18, 42, 31, 14, 46, 20, 48, 47, 24, 23, 49, 45, 19, 38, 39, 11, 1, 32, 25, 35, 8, 17, 7, 9, 4, 2, 34, 10, 3
            };

            // ****-****--***-**--****-*--****
            //   4    4    3   2    4  1    4
            //   7  x 7  x 4 x 2  x 7  x 7

            // Act
            var actual = AdapterArray.CountUnique(input);

            // Assert
            Assert.Equal(19208, actual);
        }
        public void Setup()
        {
            var adapterStrings = File.ReadAllLines("Data/Data.txt");

            _adapterArray = new AdapterArray(adapterStrings);
        }
Пример #12
0
        // == == == == == Puzzle 2 == == == == ==
        public static string Puzzle2(string input)
        {
            var aa = new AdapterArray(input);

            return(aa.FindPossibleAdapterArrangements().ToString());
        }
Пример #13
0
        // == == == == == Puzzle 1 == == == == ==
        public static string Puzzle1(string input)
        {
            var aa = new AdapterArray(input);

            return(aa.ChainAllAdapters().ToString());
        }