Skip to content

Commit

Permalink
show number when katanuki produced errors
Browse files Browse the repository at this point in the history
  • Loading branch information
instructr13 committed Oct 15, 2024
1 parent d524138 commit 0e7574b
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions apps/frontend/src/app/routes/replay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,22 @@ export default function Page() {

const boards: string[][] = [structuredClone(replayInfo.problem.board.start)];

for (const op of replayInfo.answer.ops) {
const afterBoard = easyKatanuki(replayInfo.problem, op);
for (const [i, op] of replayInfo.answer.ops.entries()) {
try {
const afterBoard = easyKatanuki(replayInfo.problem, op);

replayInfo.problem.board.start = afterBoard;
replayInfo.problem.board.start = afterBoard;

boards.push(afterBoard);
boards.push(afterBoard);
} catch (e) {
if (e instanceof Error) {
throw new Error(`Failed to apply operation ${i + 1}`, { cause: e });
}

console.error(e);

throw new Error(`Failed to apply operation ${i + 1}`);
}
}

replayInfo.problem.board.start = boards[0];
Expand Down

0 comments on commit 0e7574b

Please sign in to comment.