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


C++ Stone::isPassed方法代码示例

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


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

示例1: arrange

void Ground::arrange(Stone &stone_to_arrange, int bx, int by) {
  if (stone_to_arrange.isPassed())
    return;

  // speed-up: int gx = bx / BOARD_WIDTH, gy = by / BOARD_HEIGHT;
  int gx = bx >> 3, gy = by >> 3;

  // speed-up: int remx = bx % BOARD_WIDTH, remy = by % BOARD_HEIGHT;
  int remx = bx & 7ull, remy = by & 7ull;

  BitBoard arrange = stone_to_arrange.getBitBoard();

  BitBoard current = shiftDown(shiftRight(arrange, remx), remy);
  BitBoard right = shiftDown(shiftLeft(arrange, BOARD_WIDTH - remx), remy);
  BitBoard bottom = shiftUp(shiftRight(arrange, remx), BOARD_HEIGHT - remy);
  BitBoard right_bottom = shiftUp(shiftLeft(arrange, BOARD_WIDTH - remx), BOARD_HEIGHT - remy);

  _obstacle[gy * GROUND_BITBOARD_WIDTH + gx] |= current;
  _obstacle[gy * GROUND_BITBOARD_WIDTH + gx + 1] |= right;
  _obstacle[(gy + 1) * GROUND_BITBOARD_WIDTH + gx] |= bottom;
  _obstacle[(gy + 1) * GROUND_BITBOARD_WIDTH + gx + 1] |= right_bottom;

  arrangeContact(_contact, stone_to_arrange.getBitBoard(), bx - 1, by);
  arrangeContact(_contact, stone_to_arrange.getBitBoard(), bx, by - 1);
  arrangeContact(_contact, stone_to_arrange.getBitBoard(), bx + 1, by);
  arrangeContact(_contact, stone_to_arrange.getBitBoard(), bx, by + 1);

  arrangeContact(_right_contact, stone_to_arrange.getBitBoard(), bx - 1, by);
  arrangeContact(_bottom_contact, stone_to_arrange.getBitBoard(), bx, by - 1);
  arrangeContact(_left_contact, stone_to_arrange.getBitBoard(), bx + 1, by);
  arrangeContact(_top_contact, stone_to_arrange.getBitBoard(), bx, by + 1);

  updateContactAndClosedArray();
}
开发者ID:tkhrotn,项目名称:ZKfinder,代码行数:34,代码来源:ground.cpp


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