Пример #1
0
        public void Part1()
        {
            List <int> ops = opsPure.GetRange(0, opsPure.Count);
            vMachine   m   = new vMachine(ops, 12, 2);

            m.Operate();
            Console.WriteLine("Part 1: " + m.returnOps()[0]);
        }
Пример #2
0
 public void Part2()
 {
     foreach (int noun in Enumerable.Range(0, 99))
     {
         foreach (int verb in Enumerable.Range(0, 99))
         {
             List <int> ops = opsPure.GetRange(0, opsPure.Count);
             vMachine   m   = new vMachine(ops, noun, verb);
             m.Operate();
             if (m.returnOps()[0] == 19690720)
             {
                 Console.WriteLine("Part 2: " + (100 * noun + verb).ToString());
                 return;
             }
         }
     }
     Console.WriteLine("Part 2: OOPS");
 }