From 55382f4070211cb22c21ccfaa605ce914cde3bcc Mon Sep 17 00:00:00 2001 From: Thibault Duplessis Date: Mon, 23 Dec 2024 08:41:25 +0100 Subject: [PATCH] remove more debug from evalCache.ts --- ui/analyse/src/evalCache.ts | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/ui/analyse/src/evalCache.ts b/ui/analyse/src/evalCache.ts index a59639a296bae..f86a0efa0ef2d 100644 --- a/ui/analyse/src/evalCache.ts +++ b/ui/analyse/src/evalCache.ts @@ -14,17 +14,17 @@ export interface EvalCacheOpts { upgradable: boolean; } -// const evalPutMinDepth = 20; -// const evalPutMinNodes = 3e6; +const evalPutMinDepth = 20; +const evalPutMinNodes = 3e6; const evalPutMaxMoves = 10; -// function qualityCheck(ev: Tree.ClientEval): boolean { -// // quick mates may never reach the minimum nodes or depth -// if (Math.abs(ev.mate ?? 99) < 15) return true; -// // below 500k nodes, the eval might come from an imminent threefold repetition -// // and should therefore be ignored -// return ev.nodes > 500000 && (ev.depth >= evalPutMinDepth || ev.nodes > evalPutMinNodes); -// } +function qualityCheck(ev: Tree.ClientEval): boolean { + // quick mates may never reach the minimum nodes or depth + if (Math.abs(ev.mate ?? 99) < 15) return true; + // below 500k nodes, the eval might come from an imminent threefold repetition + // and should therefore be ignored + return ev.nodes > 500000 && (ev.depth >= evalPutMinDepth || ev.nodes > evalPutMinNodes); +} // from client eval to server eval function toPutData(variant: VariantKey, ev: Tree.ClientEval): EvalPutData { @@ -81,13 +81,13 @@ export default class EvalCache { onLocalCeval = throttle(500, () => { const node = this.opts.getNode(), ev = node.ceval; - // const fetched = this.fetchedByFen.get(node.fen); + const fetched = this.fetchedByFen.get(node.fen); if ( ev && - // !ev.cloud && - // this.fetchedByFen.has(node.fen) && - // (!fetched || fetched.depth < ev.depth) && - // qualityCheck(ev) && + !ev.cloud && + this.fetchedByFen.has(node.fen) && + (!fetched || fetched.depth < ev.depth) && + qualityCheck(ev) && this.opts.canPut() ) { this.opts.send('evalPut', toPutData(this.opts.variant, ev));