本文整理汇总了TypeScript中ceval.winningChances类的典型用法代码示例。如果您正苦于以下问题:TypeScript winningChances类的具体用法?TypeScript winningChances怎么用?TypeScript winningChances使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了winningChances类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: 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
};
}
开发者ID:ddugovic,项目名称:lila,代码行数:33,代码来源:practiceCtrl.ts
示例2: 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
};
}
开发者ID:lexisvar,项目名称:lila,代码行数:32,代码来源:practiceCtrl.ts
示例3:
n.threat.pvs.slice(1).forEach(function(pv) {
const shift = winningChances.povDiff(opposite(color as Color), pv, n.threat!.pvs[0]);
if (shift > 0.2 || isNaN(shift) || shift < 0) return;
shapes = shapes.concat(makeAutoShapesFromUci(pv.moves[0], 'paleRed', {
lineWidth: Math.round(11 - shift * 45) // 11 to 2
}));
});
开发者ID:ddugovic,项目名称:lila,代码行数:7,代码来源:autoShape.ts
示例4:
pv1s.forEach(function(pv) {
const shift = winningChances.povDiff(rcolor, pv, pv0);
if (shift >= 0 && shift < 0.2) {
shapes = shapes.concat(makeShapesFromUci(rcolor, pv.moves[0], 'paleRed', {
lineWidth: Math.round(11 - shift * 45) // 11 to 2
}));
}
});
开发者ID:ddugovic,项目名称:lila,代码行数:8,代码来源:autoShape.ts
示例5: checkCeval
function checkCeval(): void {
var node = root.node,
cur = current();
if (!cur || feedback() !== 'eval' || cur.fault.node.ply !== node.ply) return;
if (isCevalReady(node)) {
var diff = winningChances.povDiff(color, node.ceval!, cur.prev.node.eval);
if (diff > -0.035) onWin();
else onFail();
}
}
开发者ID:ddugovic,项目名称:lila,代码行数:10,代码来源:retroCtrl.ts
示例6: evalSwings
export function evalSwings(mainline: Tree.Node[], nodeFilter: (node: Tree.Node) => boolean): Tree.Node[] {
const found: Tree.Node[] = [];
const threshold = 0.075;
for (var i = 1; i < mainline.length; i++) {
var node = mainline[i];
var prev = mainline[i - 1];
if (nodeFilter(node) && node.eval && prev.eval) {
var diff = Math.abs(winningChances.povDiff('white', prev.eval, node.eval));
if (diff > threshold && hasCompChild(prev)) found.push(node);
}
}
return found;
}
开发者ID:ddugovic,项目名称:lila,代码行数:13,代码来源:nodeFinder.ts
注:本文中的ceval.winningChances类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论