Exemple #1
0
        public void PartTwo(string input, TextWriter @out)
        {
            var program = IntcodeParser.Parse(input);
            var droid   = new Droid(program);
            var map     = droid.Run();

            var source = map.First(x => x.Value == CellType.OxygenSystem).Key;

            var filled = Filler.FloodFill(map, source);
            var steps  = filled.Values.Max();

            @out.WriteLine($"Number of minutes taken to spread: {steps}");
        }
Exemple #2
0
        public void PartOne(string input, TextWriter @out)
        {
            var program = IntcodeParser.Parse(input);
            var droid   = new Droid(program);
            var map     = droid.Run();

            PrintMap(map, @out);

            var func   = BuildShortestFunction(map, Point.Origin);
            var target = map.First(x => x.Value == CellType.OxygenSystem).Key;

            var path = func(target);

            @out.WriteLine($"Found path the oxygen system with length {path.Length - 1}");
        }