本文整理汇总了TypeScript中ceval.pv2san函数的典型用法代码示例。如果您正苦于以下问题:TypeScript pv2san函数的具体用法?TypeScript pv2san怎么用?TypeScript pv2san使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pv2san函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: makeComment
function makeComment(prev, node: Tree.Node, path: Tree.Path): Comment {
let verdict, best;
const over = root.gameOver(node);
if (over === 'checkmate') verdict = 'good';
else {
const nodeEval: Eval = (node.threefold || over === 'draw') ? {
cp: 0
} : (node.ceval as Eval);
const shift = -winningChances.povDiff(root.bottomColor(), nodeEval, prev.ceval);
best = prev.ceval.pvs[0].moves[0];
if (best === node.uci || best === altCastles[node.uci]) best = null;
if (!best) verdict = 'good';
else if (shift < 0.025) verdict = 'good';
else if (shift < 0.06) verdict = 'inaccuracy';
else if (shift < 0.14) verdict = 'mistake';
else verdict = 'blunder';
}
return {
prev,
node,
path,
verdict,
best: best ? {
uci: best,
san: pv2san(root.data.game.variant.key, prev.fen, false, [best])
} : undefined
};
}
示例2: makeComment
function makeComment(prev: Tree.Node, node: Tree.Node, path: Tree.Path): Comment {
let verdict, best;
const over = root.gameOver(node);
if (over === 'checkmate') verdict = 'goodMove';
else {
const nodeEval: Eval = tbhitToEval(node.tbhit) || (
(node.threefold || over === 'draw') ? { cp: 0 } : node.ceval as Eval
);
const prevEval: Eval = tbhitToEval(prev.tbhit) || prev.ceval!;
const shift = -winningChances.povDiff(root.bottomColor(), nodeEval, prevEval);
best = nodeBestUci(prev)!;
if (best === node.uci || best === altCastles[node.uci!]) best = null;
if (!best) verdict = 'goodMove';
else if (shift < 0.025) verdict = 'goodMove';
else if (shift < 0.06) verdict = 'inaccuracy';
else if (shift < 0.14) verdict = 'mistake';
else verdict = 'blunder';
}
return {
prev,
node,
path,
verdict,
best: best ? {
uci: best,
san: pv2san(variant, prev.fen, false, [best])
} : undefined
};
}