cycles = {
var X = 1;
return input.flatMap(({ instr, val }) => {
if (instr == "addx") {
const currX = X;
X += val;
return [
{ instr: instr, opCycle: 1, opVal: val, duringX: currX, afterX: currX },
{ instr: instr, opCycle: 2, opVal: val, duringX: currX, afterX: X }
];
} else {
return [{ instr: instr, opCycle: 1, opVal: 0, duringX: X, afterX: X }];
}
});
}