Esempio n. 1
0
        public static int FindNounAndVerb(IEnumerable <int> programMemory, int expectedResult, int startRange = 0, int endRange = 99)
        {
            for (var noun = startRange; noun < endRange; ++noun)
            {
                for (var verb = startRange; verb < endRange; ++verb)
                {
                    var result = IntComputer.RunIntcode(programMemory, null, noun, verb);
                    if (result == expectedResult)
                    {
                        return(100 * noun + verb);
                    }
                }
            }

            return(-1);
        }
Esempio n. 2
0
 public static int RunIntcode(IEnumerable <int> programMemory, int?firstArgument = null, int?secondArgument = null)
 {
     return(IntComputer.RunIntcode(programMemory, null, firstArgument, secondArgument));
 }
 public static string RunDiagnostics(IEnumerable <int> programMemory, int input)
 {
     IntComputer.RunIntcode(programMemory, input);
     return($"Diagnostics saved to file {IntComputer.LogFile}");
 }