Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/hooks/useAnalysisController/useDeepAnalysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export const useDeepAnalysis = ({
analysisRetries < maxAnalysisRetries &&
!deepAnalysisStatus.current.cancelled &&
(!node.analysis.stockfish ||
!node.analysis.stockfish.done ||
(node.analysis.stockfish.depth < targetDepth &&
node.analysis.stockfish.model_optimal_cp !== 10000 &&
node.analysis.stockfish.model_optimal_cp !== -10000))
Expand Down
8 changes: 8 additions & 0 deletions src/hooks/useAnalysisController/useEngineAnalysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ export const useEngineAnalysis = (
return
}

if (currentNode.analysis.stockfish) {
currentNode.analysis.stockfish.done = false
}

const chess = new Chess(currentNode.fen)
const legalMoves = new Set(
chess
Expand Down Expand Up @@ -267,6 +271,10 @@ export const useEngineAnalysis = (
}
}
}

if (currentNode.analysis.stockfish) {
currentNode.analysis.stockfish.done = true
}
}

// Delay Stockfish analysis to prevent rapid fire when moving quickly
Expand Down
1 change: 0 additions & 1 deletion src/lib/engine/stockfish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,6 @@ class Engine {
}
} finally {
if (this.stockfish) {
this.stockfish.listen = originalListen
this.stockfish.uci('setoption name MultiPV value 100')
}
}
Expand Down
1 change: 1 addition & 0 deletions src/types/analysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export interface StockfishEvaluation {
winrate_loss_vec?: { [key: string]: number }
mate_vec?: { [key: string]: number }
is_checkmate?: boolean
done?: boolean
}

export interface CachedEngineAnalysisEntry {
Expand Down