Example #1
0
        public void Ferry_ExecuteInstructionsWaypointMode_Example()
        {
            // Arrange
            var ferry = new AdventOfCode.Day12.Ferry(waypointMode: true);

            // Act & Assert
            Assert.IsTrue(ValidateFerryStatus(ferry, (0, 0)));
            Assert.IsTrue(ValidateFerryStatus(ferry, waypoint: (10, -1)));

            ferry.ExecuteRawInstruction("F10");
            Assert.IsTrue(ValidateFerryStatus(ferry, pos: (100, -10)));

            ferry.ExecuteRawInstruction("N3");
            Assert.IsTrue(ValidateFerryStatus(ferry, waypoint: (10, -4)));

            ferry.ExecuteRawInstruction("F7");
            Assert.IsTrue(ValidateFerryStatus(ferry, pos: (170, -38)));

            ferry.ExecuteRawInstruction("R90");
            Assert.IsTrue(ValidateFerryStatus(ferry, waypoint: (4, 10)));

            ferry.ExecuteRawInstruction("F11");
            Assert.IsTrue(ValidateFerryStatus(ferry, pos: (214, 72)));
        }
Example #2
0
        public void Ferry_ExecuteInstructions_Example()
        {
            // Arrange
            var ferry = new AdventOfCode.Day12.Ferry();


            // Act & Assert
            Assert.IsTrue(ValidateFerryStatus(ferry, (0, 0)));

            ferry.ExecuteRawInstruction("F10");
            Assert.IsTrue(ValidateFerryStatus(ferry, pos: (10, 0)));

            ferry.ExecuteRawInstruction("N3");
            Assert.IsTrue(ValidateFerryStatus(ferry, pos: (10, -3)));

            ferry.ExecuteRawInstruction("F7");
            Assert.IsTrue(ValidateFerryStatus(ferry, pos: (17, -3)));

            ferry.ExecuteRawInstruction("R90");
            Assert.IsTrue(ValidateFerryStatus(ferry, dir: 'S'));

            ferry.ExecuteRawInstruction("F11");
            Assert.IsTrue(ValidateFerryStatus(ferry, pos: (17, 8)));
        }