Ejemplo n.º 1
0
        public void GetDay25Part1AnswerTest()
        {
            BigInteger expected = 268468864;
            BigInteger actual   = Day25.GetDay25Part1Answer();

            Assert.Equal(expected, actual);
        }
Ejemplo n.º 2
0
        public void Solve()
        {
            var solver = new Day25();
            var result = solver.Solve(15113849, 4206373);

            Output.WriteLine(result.ToString());
        }
Ejemplo n.º 3
0
        //[Test]
        //[TestCase("4, 5, 6", 456)]

        public void PartBTests(string input, int expectedOutput)
        {
            var day    = new Day25();
            var result = day.SolveB(input);

            Assert.AreEqual(expectedOutput, result);
        }
Ejemplo n.º 4
0
        public void GetDay25Part01AnswerTest()
        {
            BigInteger expected = 19414467;
            BigInteger actual   = Day25.GetDay25Part01Answer();

            Assert.Equal(expected, actual);
        }
Ejemplo n.º 5
0
        public void Solve()
        {
            var input  = File.ReadAllText("C:\\Code\\aoc2018\\aoc2018\\Data\\input25.txt");
            var result = Day25.Solve(input);

            _output.WriteLine(result.ToString());
        }
Ejemplo n.º 6
0
        public void Part1_Answer()
        {
            var day25  = new Day25();
            var actual = day25.SolvePart1();

            Assert.Equal(4387, actual);
        }
Ejemplo n.º 7
0
        public void Part1()
        {
            var solver = new Day25();
            var result = solver.Solve(5764801, 17807724);

            result.ShouldBe(14897079);
        }
Ejemplo n.º 8
0
        public void Task1()
        {
            var blueprint = new[]
            {
                "Begin in state A.",
                "Perform a diagnostic checksum after 6 steps.",
                "",
                "In state A:",
                "   If the current value is 0:",
                "    -Write the value 1.",
                "   - Move one slot to the right.",
                "   - Continue with state B.",
                "  If the current value is 1:",
                "    -Write the value 0.",
                "   - Move one slot to the left.",
                "   - Continue with state B.",
                "",
                "In state B:",
                "   If the current value is 0:",
                "    -Write the value 1.",
                "   - Move one slot to the left.",
                "   - Continue with state A.",
                "  If the current value is 1:",
                "    -Write the value 1.",
                "   - Move one slot to the right.",
                "   - Continue with state A."
            };

            Assert.AreEqual(3, Day25.Task1(blueprint));
        }
Ejemplo n.º 9
0
        public void RunWithTestInput()
        {
            var testInput = @"5764801
17807724".Split("\r\n");
            var answer    = new Day25().Solve(testInput);

            Assert.AreEqual("14897079", answer.Part1);
        }
Ejemplo n.º 10
0
        public void Day25Test1()
        {
            Day    _day25                 = new Day25(" 0,0,0,0\r\n 3,0,0,0\r\n 0,3,0,0\r\n 0,0,3,0\r\n 0,0,0,3\r\n 0,0,0,6\r\n 9,0,0,0\r\n12,0,0,0");
            string PartOneExpected        = "2";
            Tuple <string, string> Actual = _day25.getResult();

            Assert.AreEqual(PartOneExpected, Actual.Item1);
        }
Ejemplo n.º 11
0
        public void Day25Test4()
        {
            Day    _day25                 = new Day25("1,-1,-1,-2\r\n-2,-2,0,1\r\n0,2,1,3\r\n-2,3,-2,1\r\n0,2,3,-2\r\n-1,-1,1,-2\r\n0,-2,-1,0\r\n-2,2,3,-1\r\n1,2,2,0\r\n-1,-2,0,-2");
            string PartOneExpected        = "8";
            Tuple <string, string> Actual = _day25.getResult();

            Assert.AreEqual(PartOneExpected, Actual.Item1);
        }
Ejemplo n.º 12
0
    public static void Y2015_Day25_GenerateCode(ulong value, ulong expected)
    {
        // Act
        ulong actual = Day25.GenerateCode(value);

        // Assert
        actual.ShouldBe(expected);
    }
Ejemplo n.º 13
0
    public static void Y2015_Day25_GetCodeForWeatherMachine(int row, int column, ulong expected)
    {
        // Act
        ulong actual = Day25.GetCodeForWeatherMachine(row, column);

        // Assert
        actual.ShouldBe(expected);
    }
Ejemplo n.º 14
0
        public void GetEncryptionKey(int publicKey, int loopSize, int encryptionKey)
        {
            var day25 = new Day25();

            var actualEncryptionKey = day25.GetEncryptionKey(publicKey, loopSize);

            Assert.AreEqual(encryptionKey, actualEncryptionKey);
        }
Ejemplo n.º 15
0
        public void Day25_Part1_Examples_Codes()
        {
            var d = new Day25();

            var expected = 31916031;
            var actual   = d.GenerateNextCode(20151125);

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 16
0
        public void Day25_Part1_Solution()
        {
            var d = new Day25();

            var expected = 2650453;
            var actual   = d.GetCodeAtPosition(20151125, 2978, 3083);

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 17
0
        public void Day25Part1TestExample()
        {
            var day25 = new Day25();

            var actual   = day25.Part1(5764801, 17807724);
            var expected = 14897079;

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 18
0
        public void Day25Part1Test()
        {
            var day25 = new Day25();

            var actual   = day25.Part1(10441485, 1004920);
            var expected = 17032383;

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 19
0
        public void Day25()
        {
            var day = new Day25();

            Assert.AreEqual(537165825, day.PlayGuided());

            // Day 25 doesn't have a part 2.  Its star is automatically granted after
            // solving the other 49 puzzles
        }
Ejemplo n.º 20
0
        private static void Main()
        {
            const string PATH  = @"C:\Users\User\Documents\input.txt";
            var          input = File.ReadAllLines(PATH);

            Console.WriteLine(DateTime.Now.TimeOfDay);
            Day25.Day25_1(input);
            Console.WriteLine(DateTime.Now.TimeOfDay);
        }
Ejemplo n.º 21
0
    public void Should_calculate_lowest_energy()
    {
        var inputPath = Path.Combine(TestContext.CurrentContext.TestDirectory, "Day25Tests/Input/example.txt");
        var input     = File.ReadLines(inputPath);

        var result = Day25.CalculateStepsWithoutCucumbers(input.ToArray());

        Assert.That(result, Is.EqualTo(58));
    }
Ejemplo n.º 22
0
        public void Day25_Part1_Examples_Combined()
        {
            var d = new Day25();

            var expected = 21629792;
            var actual   = d.GetCodeAtPosition(20151125, 2, 2);

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 23
0
        public int Part2(string input, int checkSumAfterSteps)
        {
            var target = new Day25(input);

            for (var i = 0; i < checkSumAfterSteps; i++)
            {
                target.Step();
            }
            return(target.CheckSum);
        }
Ejemplo n.º 24
0
    public void Y2020_Day25_GetPrivateKey_Returns_Correct_Value()
    {
        // Arrange
        int cardPublicKey = 5764801;
        int doorPublicKey = 17807724;

        // Act
        long actual = Day25.GetPrivateKey(cardPublicKey, doorPublicKey);

        // Assert
        actual.ShouldBe(14897079);
    }
Ejemplo n.º 25
0
        public void PartTwoTest()
        {
            // Arrange
            var target = new Day25();

            // Act
            var result = target.Debug(Part.Two);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual("Merry Christmas!", result);
        }
Ejemplo n.º 26
0
        public int Part1(string input, int checkSumAfterSteps)
        {
            var target = new Day25(input);

            for (var i = 0; i < checkSumAfterSteps; i++)
            {
                //if (i % 10000 == 0)
                //    TestContext.Progress.WriteLine($"Step {i + 1}");
                target.Step();
            }
            return(target.CheckSum);
        }
Ejemplo n.º 27
0
        public void PartOneTest(string[] input, long expected)
        {
            // Arrange
            var target = new Day25(input);

            // Act
            var result = target.Debug(Part.One);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(expected, result);
        }
Ejemplo n.º 28
0
        public void PartOne()
        {
            // Arrange
            var target = new Day25();

            // Act
            var result = target.Debug(Part.One);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(19980801L, result);
        }
        public void Puzzle_A()
        {
            // Arrenge
            string expected = "";
            string input    = PuzzleInput.GetInputAsText(day);

            // Act
            var actual = Day25.PuzzleA();

            // Assert
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 30
0
    public void Part1()
    {
        var input = new string[]
        {
            "5764801",
            "17807724"
        };
        var day      = new Day25();
        var actual   = day.Part1(input);
        var expected = 14897079;

        Assert.Equal(expected, actual);
    }