Exemplo n.º 1
0
        public override object Task1()
        {
            thrusterCode = IntCode.Tools.ParseCode(input[0]);
            IntCode.Emulator ICE       = new IntCode.Emulator(thrusterCode);
            long             maxSignal = 0;

            var response = IntCode.Emulator.ResultTemplate;

            foreach (int[] arr in Permutator.Permutate(new int[] { 0, 1, 2, 3, 4 }))
            {
                response.Item2 = 0;
                foreach (int s in arr)
                {
                    ICE.Reboot();
                    ICE.QueueInput(s, response.Item2);
                    response = ICE.Run();
                }
                if (response.Item2 > maxSignal)
                {
                    maxSignal = response.Item2;
                }
            }
            return(maxSignal);
        }
Exemplo n.º 2
0
 public override object Task1()
 {
     IntCode.Emulator ICE = new IntCode.Emulator(input[0]);
     ICE.QueueInput(1);
     return(ICE.Run().Item2);
 }