fix : analysis with stalemate game

This commit is contained in:
GuillaumeSD
2025-01-07 00:03:00 +01:00
parent abebfae43a
commit 151277524b
2 changed files with 22 additions and 1 deletions

View File

@@ -10,7 +10,7 @@ import {
parseEvaluationResults,
} from "./helpers/parseResults";
import { computeAccuracy } from "./helpers/accuracy";
import { getWhoIsCheckmated } from "../chess";
import { getIsStalemate, getWhoIsCheckmated } from "../chess";
import { getLichessEval } from "../lichess";
import { getMovesClassification } from "./helpers/moveClassification";
import { EngineWorker } from "@/types/engine";
@@ -158,6 +158,22 @@ export class UciEngine {
});
continue;
}
const isStalemate = getIsStalemate(fen);
if (isStalemate) {
positions.push({
lines: [
{
pv: [],
depth: 0,
multiPv: 1,
cp: 0,
},
],
});
continue;
}
const result = await this.evaluatePosition(fen, depth);
positions.push(result);
setEvaluationProgress?.(