jsadvent/solutions/2019/5.js

18 lines
386 B
JavaScript
Raw Normal View History

2020-12-10 08:33:00 +00:00
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();
},
};