• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

TypeScript util.opposite函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中chessground/util.opposite函数的典型用法代码示例。如果您正苦于以下问题:TypeScript opposite函数的具体用法?TypeScript opposite怎么用?TypeScript opposite使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了opposite函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1:

 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


示例2: featured

function featured(f): VNode {
  return h('div.tour__featured', [
    featuredPlayer(f[opposite(f.color)]),
    miniBoard(f),
    featuredPlayer(f[f.color])
  ]);
}
开发者ID:ornicar,项目名称:lila,代码行数:7,代码来源:table.ts


示例3: view

export function view(ctrl: AnalyseCtrl) {
  if (!promoting) return;
  var pieces = ['queen', 'knight', 'rook', 'bishop'];
  if (ctrl.data.game.variant.key === "antichess") pieces.push('king');

  return renderPromotion(ctrl, promoting.dest, pieces,
    util.opposite(ctrl.chessground.state.turnColor),
    ctrl.chessground.state.orientation);
}
开发者ID:lexisvar,项目名称:lila,代码行数:9,代码来源:promotion.ts


示例4: opposite

 return xhr.tablebase(opts.tablebaseEndpoint, effectiveVariant, fen).then((res: TablebaseData) => {
   const move = res.moves[0];
   return {
     fen: fen,
     best: move && move.uci,
     winner: res.checkmate ? opposite(colorOf(fen)) : (
       res.stalemate ? undefined : winnerOf(fen, move!)
     )
   } as SimpleTablebaseHit
 });
开发者ID:luanlv,项目名称:lila,代码行数:10,代码来源:explorerCtrl.ts


示例5: getMaterialDiff

export function getMaterialDiff(pieces: cg.Pieces): MaterialDiff {
  const diff: MaterialDiff = {
    white: { king: 0, queen: 0, rook: 0, bishop: 0, knight: 0, pawn: 0 },
    black: { king: 0, queen: 0, rook: 0, bishop: 0, knight: 0, pawn: 0 },
  };
  for (let k in pieces) {
    const p = pieces[k]!, them = diff[opposite(p.color)];
    if (them[p.role] > 0) them[p.role]--;
    else diff[p.color][p.role]++;
  }
  return diff;
}
开发者ID:ornicar,项目名称:lila,代码行数:12,代码来源:util.ts


示例6: renderEnd

function renderEnd(root: AnalyseCtrl, end: string): VNode {
  const isMate = end === 'checkmate';
  const color = isMate ? opposite(root.turnColor()) : root.turnColor();
  return h('div.player', [
    color ? h('div.no-square', h('piece.king.' + color)) : h('div.icon.off', '!'),
    h('div.instruction', [
      h('strong', root.trans.noarg(end)),
      isMate ?
        h('em', h('color', root.trans.noarg(color === 'white' ? 'whiteWinsGame' : 'blackWinsGame'))) :
        h('em', root.trans.noarg('theGameIsADraw'))
    ])
  ]);
}
开发者ID:ornicar,项目名称:lila,代码行数:13,代码来源:practiceView.ts


示例7: renderEnd

function renderEnd(color: Color, end: string): VNode {
  if (end === 'checkmate') color = opposite(color);
  return h('div.player', [
    color ? h('div.no-square', h('piece.king.' + color)) : h('div.icon.off', '!'),
    h('div.instruction', [
      h('strong', endText[end]),
      h('em', end === 'checkmate' ? [
        h('color', color),
        ' wins.'
      ] : ['The game is a draw.'])
    ])
  ]);
}
开发者ID:lexisvar,项目名称:lila,代码行数:13,代码来源:practiceView.ts


示例8: featuredPlayer

function featuredPlayer(f, orientation) {
  const p = f[orientation === 'top' ? opposite(f.color) : f.color];
  return h('div.vstext.' + orientation, [
    p.berserk ? h('i', {
      attrs: {
        'data-icon': '`',
        title: 'Berserk'
      }
    }) : null,
    h('strong', '#' + p.rank),
    renderPlayer(p, true, true, false)
  ]);
}
开发者ID:ddugovic,项目名称:lila,代码行数:13,代码来源:side.ts


示例9: function

 var makeCgOpts = function() {
   const node = vm.node;
   const color: Color = node.ply % 2 === 0 ? 'white' : 'black';
   const dests = readDests(node.dests);
   const movable = (vm.mode === 'view' || color === data.puzzle.color) ? {
     color: (dests && Object.keys(dests).length > 0) ? color : null,
     dests: dests || {}
   } : {
     color: null,
     dests: {}
   };
   const config = {
     fen: node.fen,
     orientation: data.puzzle.color,
     turnColor: color,
     movable: movable,
     premovable: {
       enabled: false
     },
     check: !!node.check,
     lastMove: uciToLastMove(node.uci)
   };
   if (node.ply >= vm.initialNode.ply) {
     if (!dests && !node.check) {
       // premove while dests are loading from server
       // can't use when in check because it highlights the wrong king
       config.turnColor = opposite(color);
       config.movable.color = color;
       config.premovable.enabled = true;
     } else if (vm.mode !== 'view' && color !== data.puzzle.color) {
       config.movable.color = data.puzzle.color;
       config.premovable.enabled = true;
     }
   }
   vm.cgConfig = config;
   return config;
 };
开发者ID:ddugovic,项目名称:lila,代码行数:37,代码来源:ctrl.ts


示例10: h

    ];
    const nothing = !ctrl.completion()[1];
    return [
      h('div.player', [
        h('div.no-square', h('piece.king.' + ctrl.color)),
        h('div.instruction', [
          h('em', nothing ?
            'No mistakes found for ' + ctrl.color :
            'Done reviewing ' + ctrl.color + ' mistakes'),
          h('div.choices.end', [
            nothing ? null : h('a', {
              hook: bind('click', ctrl.reset)
            }, 'Do it again'),
            h('a', {
              hook: bind('click', flip)
            }, 'Review ' + opposite(ctrl.color) + ' mistakes')
          ])
        ])
      ])
    ];
  },
};

function renderFeedback(root: AnalyseCtrl, fb) {
  const ctrl: RetroCtrl = root.retro!;
  const current = ctrl.current();
  if (ctrl.isSolving() && current && root.path !== current.prev.path)
  return feedback.offTrack(ctrl);
  if (fb === 'find') return current ? feedback.find(ctrl) :
    feedback.end(ctrl, root.flip, root.hasFullComputerAnalysis);
  return feedback[fb](ctrl);
开发者ID:lexisvar,项目名称:lila,代码行数:31,代码来源:retroView.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript util.pos2key函数代码示例发布时间:2022-05-24
下一篇:
TypeScript util.key2pos函数代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap