Exemplo n.º 1
0
        static void Main()
        {
            var input = File.ReadAllText("../../../input.txt").ParseLongs();

            var sw = new Stopwatch();

            sw.Start();

            for (int i = 0; i < 100; i++)
            {
                laby = new Labyrinth(input);

                var search = new BreadthFirstSearch <Point>(EqualityComparer <Point> .Default,
                                                            Expander)
                {
                    PerformParallelSearch = false
                };

                var oxygen = search.FindFirst(laby.Origin, n => n == laby.OxygenPos);
                //Console.WriteLine($"Part 1: The droid need {oxygen.Length} steps.");

                var filled = search.FindLeafs(laby.OxygenPos);

                var longestPath = filled.Max(path => path.Length);
                //Console.WriteLine($"Part 2: The point furthest from the oxygen is {longestPath} steps away.");
            }
            sw.Stop();
            Console.WriteLine($"Solving took {sw.ElapsedMilliseconds}ms.");

            Console.WriteLine("Labyrinth map:");
            Console.WriteLine(laby.ToString());

            _ = Console.ReadLine();
        }