Beispiel #1
0
 public firewallLayer(firewallLayer layer)
 {
     depth      = layer.depth;
     range      = layer.range;
     scannerPos = layer.scannerPos;
     direction  = layer.direction;
 }
Beispiel #2
0
        static void PartOne(List <firewallLayer> firewall, int maxDepth)
        {
            int packetPos    = 0;
            int tripSeverity = 0;

            do
            {
                firewallLayer caught = firewall.Where(l => l.depth == packetPos && l.scannerPos == 0).FirstOrDefault();
                if (caught != null)
                {
                    tripSeverity += (caught.depth * caught.range);
                }

                moveScanners(firewall);
                packetPos++;
            }while (packetPos <= maxDepth);

            Console.WriteLine("The severity of the whole trip is: " + tripSeverity);
        }