jsadvent/solutions/2019/5.js
2020-12-10 02:33:00 -06:00

18 lines
386 B
JavaScript

const { parse, run } = require('./_intcode');
const gravityAssist = (program, noun, verb) => {
const pClone = program.slice();
pClone[1] = noun;
pClone[2] = verb;
return run(pClone).memory[0];
};
module.exports = {
'1': (input) => {
return run(parse(input), [1n]).outputs.glib.sum();
},
2: (input) => {
return run(parse(input), [5n]).outputs.glib.sum();
},
};