Exemple #1
0
        protected override int Part2(string[] input)
        {
            var intcode = input[0];

            var(map, _) = BuildMapAndFindOxygen(intcode);

            var minutes = 0;

            while (map.AllPoints(val => val == MapSpace).Count() > 0)
            {
                foreach (var p in map.AllPoints(val => val == MapOxygen).ToList())
                {
                    foreach (var d in AllDirections())
                    {
                        var neighboor = MoveGenerator.MoveFrom(p, d);
                        if (map[neighboor] == MapSpace)
                        {
                            map[neighboor] = MapOxygen;
                        }
                    }
                }
                minutes++;
            }
            return(minutes);
        }