function runProgram(state) {
const startState = [...state];
const instructions = createOpcodes(state);
for(let i = 0; i < instructions.length; i++) {
const [op, pos1, pos2, position] = instructions[i];
const val1 = parseInt(startState[pos1], 10);
const val2 = parseInt(startState[pos2], 10);
if(op === "99") {
break;
}
if(op === "1") {
startState[position] = val1 + val2;
}
if(op === "2") {
startState[position] = val1 * val2;
}
}
return startState[0]
}