Example #1
0
        private static void Part2()
        {
            var delay = 0;

            do
            {
                var firewall = new Firewall(GetLayers());

                foreach (var i in Enumerable.Range(0, delay))
                {
                    firewall.TickLayers();
                }

                while (firewall.Tick())
                {
                    ;
                }

                if (firewall.Caught.Count == 0)
                {
                    Console.WriteLine($"Lowest delay possible is {delay}");
                    return;
                }
                else
                {
                    delay++;
                }
                if (delay % 1000 == 0)
                {
                    Console.WriteLine($"Now at delay of {delay}");
                }
            } while(true);
        }
Example #2
0
        private static void Part1()
        {
            var firewall = new Firewall(GetLayers());

            while (firewall.Tick())
            {
                ;
            }
            Console.WriteLine($"Severity is {firewall.Severity}");
        }