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

@@ -147,6 +147,11 @@ export const getEvaluationBarValue = (
return { whiteBarPercentage, label };
};
export const getIsStalemate = (fen: string): boolean => {
const game = new Chess(fen);
return game.isStalemate();
};
export const getWhoIsCheckmated = (fen: string): "w" | "b" | null => {
const game = new Chess(fen);
if (!game.isCheckmate()) return null;