function processInstructions(instructions) {
const atomic = _.flatMap(instructions, ({ cmd, value }) => {
if (cmd === "noop") {
return [{ cmd }];
}
if (cmd === "addx") {
return [
{ cmd, value: 0 },
{ cmd, value }
];
}
});
const results = atomic.map((item, j, list) => {
cycle: j, x: j > 0? list[j -1] +item.value
})
}