function wirePositionsWithSignalDelay(path) {
let x = 0;
let y = 0;
let d = 1;
const positions = [];
for (let [dx, dy] of path) {
while (dx || dy) {
let nextPos;
if (dx > 0) {
positions.push([(x += 1), y, d++]);
dx -= 1;
} else if (dx < 0) {
positions.push([(x -= 1), y, d++]);
dx += 1;
} else if (dy > 0) {
positions.push([x, (y += 1), d++]);
dy -= 1;
} else if (dy < 0) {
positions.push([x, (y -= 1), d++]);
dy += 1;
}
}
}
return positions;
}