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


C++ Groups::IsGameOver方法代码示例

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


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

示例1: off

/** Finds inferior cells, builds vcs. Sets moves to consider to all
    empty cells. If fillin causes terminal state, sets
    m_fillinCausedWin to true and recomputes fillin/vcs with ice
    temporarily turned off (so it can pass the players a non-empty
    consider set).
*/
HexPoint BenzenePlayer::InitSearch(HexBoard& brd, HexColor color, 
                                   bitset_t& consider, double& score)
{
    // Resign if the game is already over
    Groups groups;
    GroupBuilder::Build(brd.GetPosition(), groups);
    if (groups.IsGameOver()) 
    {
        score = IMMEDIATE_LOSS;
        return RESIGN;
    }
    StoneBoard original(brd.GetPosition());
    brd.ComputeAll(color);
    m_fillinCausedWin = false;
    m_fillinWinner = EMPTY;
    if (brd.GetGroups().IsGameOver()) 
    {
        // Fillin caused win, remove and re-compute without ice.
        m_fillinCausedWin = true;
        m_fillinWinner = brd.GetGroups().GetWinner();
        LogInfo() << "Captured cells caused win! Removing...\n";
        brd.GetPosition().SetPosition(original);
        bool oldUseIce = brd.UseICE();
        brd.SetUseICE(false);
        brd.ComputeAll(color);
        brd.SetUseICE(oldUseIce);
        BenzeneAssert(!brd.GetGroups().IsGameOver());
    } 
    consider = brd.GetPosition().GetEmpty();
    score = 0;
    return INVALID_POINT;
}
开发者ID:PawelTroka,项目名称:LogicalGamesEnginesGenerator,代码行数:38,代码来源:BenzenePlayer.cpp

示例2: IsGameOver

bool GameUtil::IsGameOver(const Game& game)
{
    Groups groups;
    GroupBuilder::Build(game.Board(), groups);
    return groups.IsGameOver();
}
开发者ID:PawelTroka,项目名称:LogicalGamesEnginesGenerator,代码行数:6,代码来源:Game.cpp


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