当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript ceval.pv2san函数代码示例

本文整理汇总了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
    };
  }
开发者ID:lexisvar,项目名称:lila,代码行数:32,代码来源:practiceCtrl.ts

示例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
    };
  }
开发者ID:ddugovic,项目名称:lila,代码行数:33,代码来源:practiceCtrl.ts


注:本文中的ceval.pv2san函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。