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


C++ HtpCommand::CheckNuArgLessEqual方法代码示例

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


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

示例1: CmdSolveState

/** Solves the current state with dfpn using the current hashtable. */
void DfpnCommands::CmdSolveState(HtpCommand& cmd)
{
    cmd.CheckNuArgLessEqual(3);
    HexColor colorToMove = m_game.Board().WhoseTurn();
    if (cmd.NuArg() >= 1)
        colorToMove = HtpUtil::ColorArg(cmd, 0);
    // DfpnBounds::MAX_WORK cannot be used as an argument to ArgMinMax()
    // directly, because it is an integral constant class member that is not
    // defined anywhere and arguments to ArgMinMax() are passed by reference.
    // Older versions of GCC (including the current Cygwin GCC 4.3.4) generate
    // and error ("undefined reference to DfpnBounds::MAX_WORK"), probably in
    // accordance to the C++ standard. The best solution would be to change
    // GtpCommand::ArgMinMax() in Fuego to pass arguments by value.
    const DfpnBoundType maxWork = DfpnBounds::MAX_WORK;
    DfpnBoundType maxPhi = maxWork;
    DfpnBoundType maxDelta = maxWork;
    if (cmd.NuArg() >= 2)
        maxPhi = cmd.ArgMinMax<DfpnBoundType>(1, 0, maxWork);
    if (cmd.NuArg() >= 3)
        maxDelta = cmd.ArgMinMax<DfpnBoundType>(2, 0, maxWork);
    DfpnBounds maxBounds(maxPhi, maxDelta);
    PointSequence pv;
    HexBoard& brd = m_env.SyncBoard(m_game.Board());
    HexColor winner 
        = m_solver.StartSearch(HexState(m_game.Board(), colorToMove), brd, 
                               m_positions, pv, maxBounds);
    cmd << winner;
}
开发者ID:PawelTroka,项目名称:LogicalGamesEnginesGenerator,代码行数:29,代码来源:DfpnCommands.cpp

示例2: CmdOpenDB

/** Opens a database. 
    Usage: "db-open [filename]"
*/
void DfpnCommands::CmdOpenDB(HtpCommand& cmd)
{
    cmd.CheckNuArgLessEqual(3);
    std::string filename = cmd.Arg(0);
    try {
        m_db.reset(new DfpnDB(filename));
    }
    catch (BenzeneException& e) {
        m_db.reset(0);
        throw HtpFailure() << "Error opening db: '" << e.what() << "'\n";
    }
}
开发者ID:PawelTroka,项目名称:LogicalGamesEnginesGenerator,代码行数:15,代码来源:DfpnCommands.cpp


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