本文整理汇总了C++中GoBoard::All方法的典型用法代码示例。如果您正苦于以下问题:C++ GoBoard::All方法的具体用法?C++ GoBoard::All怎么用?C++ GoBoard::All使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GoBoard
的用法示例。
在下文中一共展示了GoBoard::All方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindInfluence
void GoInfluence::FindInfluence(const GoBoard& board,
int nuExpand,
int nuShrink,
SgBWSet* influence)
{
SgBWSet result = SgBWSet(board.All(SG_BLACK), board.All(SG_WHITE));
SgBWSet next;
const int size = board.Size();
for (int i = 1; i <= nuExpand; ++i)
{
for (SgBlackWhite c = SG_BLACK; c <= SG_WHITE; ++c)
{
SgBlackWhite opp = SgOppBW(c);
next[c] = result[c].Border(size) - result[opp];
}
result[SG_BLACK] |= (next[SG_BLACK] - next[SG_WHITE]);
result[SG_WHITE] |= (next[SG_WHITE] - next[SG_BLACK]);
}
for (int i = 1; i <= nuShrink; ++i)
{
result[SG_BLACK] = result[SG_BLACK].Kernel(size);
result[SG_WHITE] = result[SG_WHITE].Kernel(size);
}
*influence = result;
}
示例2: LibertyAveragex10
int LibertyAveragex10(const GoBoard& board, SgBlackWhite color)
{
int nuLibs = 0, nuBlocks = 0;
const int size = board.Size();
for (SgConnCompIterator it(board.All(color), board.Size()); it; ++it)
{
++nuBlocks;
nuLibs += ((*it).Border(size) & board.AllEmpty()).Size();
}
return (nuBlocks == 0) ? 0 : 10 * nuLibs / nuBlocks;
}