reset fix

This commit is contained in:
Theo Browne
2026-02-22 04:32:41 -08:00
parent deeeeae8f7
commit 54c45f6028

10
game.ts
View File

@@ -260,7 +260,7 @@ export async function runGame(
startRound = lastCompletedRound.num + 1; startRound = lastCompletedRound.num + 1;
} }
const endRound = startRound + runs - 1; let endRound = startRound + runs - 1;
for (let r = startRound; r <= endRound; r++) { for (let r = startRound; r <= endRound; r++) {
while (state.isPaused) { while (state.isPaused) {
@@ -268,6 +268,14 @@ export async function runGame(
} }
const roundGeneration = state.generation; const roundGeneration = state.generation;
// Reset round counter if generation changed (e.g. admin reset)
const latest = state.completed.at(-1);
const expectedR = latest ? latest.num + 1 : 1;
if (r !== expectedR) {
r = expectedR;
endRound = r + runs - 1;
}
const shuffled = shuffle([...MODELS]); const shuffled = shuffle([...MODELS]);
const prompter = shuffled[0]!; const prompter = shuffled[0]!;
const contA = shuffled[1]!; const contA = shuffled[1]!;