本文整理汇总了C++中GoBoard::Rules方法的典型用法代码示例。如果您正苦于以下问题:C++ GoBoard::Rules方法的具体用法?C++ GoBoard::Rules怎么用?C++ GoBoard::Rules使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GoBoard
的用法示例。
在下文中一共展示了GoBoard::Rules方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetRelevantMoves
SgPointSet SpUtil::GetRelevantMoves(GoBoard& bd, SgBlackWhite toPlay,
bool useFilter)
{
SgPointSet legal;
for (SgSetIterator it(bd.AllEmpty()); it; ++it)
if (bd.IsLegal(*it))
legal.Include(*it);
if (! useFilter)
return legal;
GoSafetySolver safetySolver(bd);
SgBWSet safe;
safetySolver.FindSafePoints(&safe);
SgBlackWhite opp = SgOppBW(toPlay);
SgPointSet moves;
const GoRules& rules = bd.Rules();
const bool captureDead = rules.CaptureDead();
//const bool japaneseScoring = rules.JapaneseScoring();
for (SgSetIterator it(legal); it; ++it)
{
SgPoint p = *it;
const bool isSafe = safe[toPlay].Contains(p);
const bool isSafeOpp = safe[opp].Contains(p);
const bool hasOppNeighbors = bd.HasNeighbors(p, opp);
if ( (! isSafe && ! isSafeOpp)
|| (isSafe && captureDead && hasOppNeighbors)
// || (isSafeOpp && ! japaneseScoring)
)
moves.Include(p);
}
return moves;
}
示例2: GoBoardSynchronizer
GoPlayer::GoPlayer(const GoBoard& bd)
: GoBoardSynchronizer(bd),
m_currentNode(0),
m_bd(bd.Size(), GoSetup(), bd.Rules()),
m_variant(0)
{
SetSubscriber(m_bd);
ClearSearchTraces();
}
示例3: SetFromBoard
void GoBoardHistory::SetFromBoard(const GoBoard& bd)
{
m_boardSize = bd.Size();
m_rules = bd.Rules();
m_setup = bd.Setup();
m_moves.Clear();
for (int i = 0; i < bd.MoveNumber(); ++i)
m_moves.PushBack(bd.Move(i));
m_toPlay = bd.ToPlay();
}