Пример #1
0
        public void Part1Sample()
        {
            Ferry    ferry         = new Ferry();
            Position ferryPosition = new Position
            {
                Direction     = 90,
                EastPosition  = 0,
                NorthPosition = 0
            };

            ferry.MoveMany(new Part1FerryMover(ferryPosition), GetSampleNavigationInstructions());
            Assert.Equal(25, ferryPosition.GetManhattanDistance());
        }
Пример #2
0
        public void Part1()
        {
            Ferry    ferry         = new Ferry();
            Position ferryPosition = new Position
            {
                Direction     = 90,
                EastPosition  = 0,
                NorthPosition = 0
            };

            ferry.MoveMany(new Part1FerryMover(ferryPosition), StringListRetriever.Retreive("InputList12.txt").Select(x => new NavigationInstruction(x)).ToList());
            Assert.Equal(420, ferryPosition.GetManhattanDistance());
        }
Пример #3
0
        public static void ExecuteDay(string fileLocation = "PuzzleInput/Day12.txt")
        {
            string alltext = File.ReadAllText(fileLocation);

            var f = new Ferry(alltext);

            f.Travel();

            Logger.LogMessage(LogLevel.ANSWER, "12A: " + (Utilities.GetManhattenDistance(0, f.CurrentPosition.X) + Utilities.GetManhattenDistance(0, f.CurrentPosition.Y)));

            var f2 = new Ferry(alltext);

            f2.TravelUsingWaypoint();

            Logger.LogMessage(LogLevel.ANSWER, "12B: " + (Utilities.GetManhattenDistance(0, f2.CurrentPosition.X) + Utilities.GetManhattenDistance(0, f2.CurrentPosition.Y)));
        }
Пример #4
0
        public void Part2()
        {
            Ferry ferry = new Ferry();

            Assert.Equal(2032, ferry.GetSeatsAfterEquilibriumPart2(StringListRetriever.Retreive("InputList11.txt").ToList()));
        }
Пример #5
0
        public void Part2Sample()
        {
            Ferry ferry = new Ferry();

            Assert.Equal(26, ferry.GetSeatsAfterEquilibriumPart2(GetSampleLayout()));
        }