This commit is contained in:
Stefan
2025-11-24 17:53:48 +01:00
parent b923f68841
commit 1dd54e8937
4 changed files with 69 additions and 32 deletions
+3 -2
View File
@@ -199,12 +199,13 @@ export default function ChessGame({ initialFen, initialPgn, initialPersonality,
// Pre-Analysis (P0)
useEffect(() => {
if (stockfish && gameRef.current.turn() === 'w' && !isAnalyzing && !gameOverState) {
const playerTurn = playerColor === 'white' ? 'w' : 'b';
if (stockfish && gameRef.current.turn() === playerTurn && !isAnalyzing && !gameOverState) {
stockfish.evaluate(gameRef.current.fen(), stockfishDepth).then(evalResult => {
setEvalP0(evalResult);
}).catch(err => console.error("Pre-analysis failed:", err));
}
}, [fen, stockfish, stockfishDepth, isAnalyzing, gameOverState]);
}, [playerColor, fen, stockfish, stockfishDepth, isAnalyzing, gameOverState]);
const updateCapturedPieces = useCallback(() => {
const history = gameRef.current.history({ verbose: true });