Exemple #1
0
        private static void RunPuzzle2()
        {
            var scan      = LoadState("input.txt");
            var automaton = new RecursiveEris(scan);

            Console.WriteLine("PUZZLE 2");
            Console.WriteLine("========");
            automaton.Advance(200);
            Console.WriteLine("Total number of bugs: " + automaton.CountBugsRecursive());
        }
Exemple #2
0
        private static void RunExamples2()
        {
            var scan      = LoadState("example1.txt");
            var automaton = new RecursiveEris(scan);

            automaton.Advance(10);
            Console.WriteLine("EXAMPLE 2");
            Console.WriteLine("=========");
            Console.WriteLine("Depth 0:");
            PrintScan(automaton);
            Console.WriteLine();

            int counter = 0;
            var parent  = automaton.ParentLevel;

            while (parent != null)
            {
                counter--;
                Console.WriteLine("Depth " + counter + ":");
                PrintScan(parent);
                Console.WriteLine();
                parent = parent.ParentLevel;
            }
            counter = 0;
            var child = automaton.ChildLevel;

            while (child != null)
            {
                counter++;
                Console.WriteLine("Depth " + counter + ":");
                PrintScan(child);
                Console.WriteLine();
                child = child.ChildLevel;
            }
            Console.WriteLine("Total number of bugs: " + automaton.CountBugsRecursive());
        }