Ejemplo n.º 1
0
        public void TestAlgorithm(params string[] data)
        {
            var coords = Loader.Load(data).ToArray();
            var map    = new SpatialMap(10, coords);

            map.CalculateAreas().Print();
        }
Ejemplo n.º 2
0
        public void FindSolutionToPart2()
        {
            var coords = Loader.Load("day6/input.txt").ToArray();

            var map    = new SpatialMap(400, coords);
            var result = map.CalculateDistances(10000, true);

            Assert.That(result, Is.EqualTo(50530));
        }
Ejemplo n.º 3
0
        public void FindSolutionToPart1()
        {
            var coords = Loader.Load("day6/input.txt").ToArray();

            var map = new SpatialMap(400, coords);

            map.CalculateAreas()
            .CheckBoundaries()
            .Print();

            var maxArea = coords.Where(x => x.Finite).Max(x => x.Area);
            var result  = coords.First(x => x.Finite && x.Area == maxArea);

            Console.WriteLine($"Answer: {result.Id.ToChar()}({result.X},{result.Y}) area : {result.Area}");
        }