public void Execute(IntcodeProgram program) { int firstParam = program.GetValueBasedOnParameterMode(1, firstParameterMode); int secondParam = program.GetValueBasedOnParameterMode(2, secondParameterMode); int resultPosition = program[program.InstructionPointer + 3]; program[resultPosition] = firstParam * secondParam; program.InstructionPointer += 4; }
public void Execute(IntcodeProgram program) { int firstVal = program.GetValueBasedOnParameterMode(1, firstParameterMode); if (firstVal != 0) { int secondVal = program.GetValueBasedOnParameterMode(2, secondParameterMode); program.InstructionPointer = secondVal; } else { program.InstructionPointer += 3; } }
public void Execute(IntcodeProgram program) { int firstVal = program.GetValueBasedOnParameterMode(1, firstParameterMode); int secondVal = program.GetValueBasedOnParameterMode(2, secondParameterMode); int thirdVal = program.GetValueBasedOnParameterMode(3, thirdParameterMode); if (firstVal == secondVal) { program[program[program.InstructionPointer + 3]] = 1; } else { program[program[program.InstructionPointer + 3]] = 0; } program.InstructionPointer += 4; }
public void Execute(IntcodeProgram program) { program.AddToOutput(program.GetValueBasedOnParameterMode(1, parameterMode)); program.InstructionPointer += 2; }