private IntType[] RunProgram(IntType[] program) { var state = new Intcode.State(program); while (Intcode.Step(state)) { // nothing } return(state.MemoryDump(program.Length)); }
private IntType?RunProgram(ref IntType[] program, IntType input) { IntType finalOutput = -1; var state = new Intcode.State(program, input); while (Intcode.Step(state)) { // nothing // consume the output var tempOut = state.PopOutput(); if (tempOut.HasValue) { finalOutput = tempOut.Value; } } program = state.MemoryDump(program.Length); return(finalOutput); }