function generateSignal(phases) {
const createAmp = (input, phase) =>
new Computer([phase, input], puzzleInput).run();
const amps = AOC.scanl(
phases,
(amp, p) => createAmp(amp.out, p),
new Computer()
);
while (amps[amps.length - 1].status.label === "AwaitingInput") {
for (let i = 0; i < amps.length; i++) {
amps[i].addInput(amps[(i - 1 + amps.length) % amps.length].out).run();
}
}
return amps[amps.length - 1].out;
}