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


C++ Pairs::GetPairNumber方法代码示例

本文整理汇总了C++中Pairs::GetPairNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ Pairs::GetPairNumber方法的具体用法?C++ Pairs::GetPairNumber怎么用?C++ Pairs::GetPairNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pairs的用法示例。


在下文中一共展示了Pairs::GetPairNumber方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetPairSwaps

void Hand::SetPairSwaps(
  const ResultType& res, 
  ValetEntryType& entry, 
  unsigned& decl,
  unsigned& leader)
{
  // This function takes care of assigning the scores to the right
  // players within a pair.  pairNo is negative if the players are
  // internally stored in the opposite order to the one that happens
  // to be at the table.

  unsigned swapNS, swapEW;
  int pairNoNS = pairs.GetPairNumber(res.north, res.south);
  assert(pairNoNS != 0);
  if (pairNoNS < 0)
  {
    entry.pairNo = static_cast<unsigned>(-pairNoNS);
    swapNS = 1;
  }
  else
  {
    entry.pairNo = static_cast<unsigned>(pairNoNS);
    swapNS = 0;
  }

  int pairNoEW = pairs.GetPairNumber(res.east, res.west);
  assert(pairNoEW != 0);
  if (pairNoEW < 0)
  {
    entry.oppNo = static_cast<unsigned>(-pairNoEW);
    swapEW = 1;
  }
  else
  {
    entry.oppNo = static_cast<unsigned>(pairNoEW);
    swapEW = 0;
  }

  if (res.declarer == VALET_NORTH || res.declarer == VALET_SOUTH)
  {
    decl = Hswap[swapNS][res.declarer == VALET_SOUTH];
    leader = Hswap[swapEW][res.declarer == VALET_SOUTH];
  }
  else if (res.declarer == VALET_EAST || res.declarer == VALET_WEST)
  {
    decl = Hswap[swapEW][res.declarer == VALET_WEST];
    leader = Hswap[swapNS][res.declarer == VALET_EAST];
  }
  else
  {
    decl = 0;
    leader = 0;
    assert(false);
  }
}
开发者ID:valet-bridge,项目名称:valet,代码行数:55,代码来源:Hand.cpp

示例2: SetPassout

void Hand::SetPassout(
  const ResultType& res,
  const float totalIMPs,
  ValetEntryType& entry)
{
  // Pass-out.
  int pairNoNS = pairs.GetPairNumber(res.north, res.south);
  assert(pairNoNS != 0);
  if (pairNoNS < 0)
    pairNoNS = -pairNoNS; // Doesn't matter for pass-out

  int pairNoEW = pairs.GetPairNumber(res.east, res.west);
  assert(pairNoEW != 0);
  if (pairNoEW < 0)
    pairNoEW = -pairNoEW; // Doesn't matter for pass-out

  entry.pairNo = static_cast<unsigned>(pairNoNS);
  entry.oppNo = static_cast<unsigned>(pairNoEW);
  entry.overall = totalIMPs;
  entry.bidScore = totalIMPs;
}
开发者ID:valet-bridge,项目名称:valet,代码行数:21,代码来源:Hand.cpp


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