) => {
/** Serialize tape from object format into linear array */
const serializeTapeObj = (tape: BFRS["tape"]) => {
const cellIdxs = Object.keys(tape).map((s) => parseInt(s, 10));
const maxCellIdx = Math.max(15, ...cellIdxs);
const linearTape = Array(maxCellIdx + 1).fill(0);
cellIdxs.forEach((i) => (linearTape[i] = tape[i] || 0));
return linearTape;
};
return (
{serializeTapeObj(state?.tape || {}).map((num, i) => (
|
))}
);
};