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


C++ GtpCommand::RemainingLine方法代码示例

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


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

示例1: CmdParam

/** Player selection.
    This command is compatible with the GoGui analyze command type "param".

    Parameters:
    @arg @c player Player id as in FuegoTestEngine::SetPlayer */
void FuegoTestEngine::CmdParam(GtpCommand& cmd)
{
    cmd.CheckNuArgLessEqual(2);
    if (cmd.NuArg() == 0)
    {
        cmd <<
            "[list/<none>/average/capture/dumbtactic/greedy/influence/"
            "ladder/liberty/maxeye/minlib/no-search/random/safe] player "
            << (m_playerId == "" ? "<none>" : m_playerId) << '\n';
    }
    else if (cmd.NuArg() >= 1 && cmd.NuArg() <= 2)
    {
        string name = cmd.Arg(0);
        if (name == "player")
        {
            try
            {
                string id = trim_copy(cmd.RemainingLine(0));
                if (id == "<none>")
                    id = "";
                SetPlayer(id);
            }
            catch (const SgException& e)
            {
                throw GtpFailure(e.what());
            }
        }
        else
            throw GtpFailure() << "unknown parameter: " << name;
    }
    else
        throw GtpFailure() << "need 0 or 2 arguments";
}
开发者ID:Awilg,项目名称:fuego,代码行数:38,代码来源:FuegoTestEngine.cpp

示例2: CmdCompareFloat

/** Run another GTP command and compare its response against a float value.
    Arguments: float command [arg...] <br>
    Returns: -1 if response is smaller than float; 1 otherwise. */
void SgGtpCommands::CmdCompareFloat(GtpCommand& cmd)
{
    double value = cmd.Arg<double>(0);
    string response = m_engine.ExecuteCommand(cmd.RemainingLine(0));
    istringstream in(response);
    double responseValue;
    in >> responseValue;
    if (! in)
        throw GtpFailure() << "response '" << response << "' is not a float";
    cmd << (responseValue < value ? "-1" : "1");
}
开发者ID:cbordeman,项目名称:gameofgo,代码行数:14,代码来源:SgGtpCommands.cpp

示例3: CmdCompareInt

/** Run another GTP command and compare its response against an integer value.
    Arguments: int command [arg...] <br>
    Returns: -1 if response is smaller than int; 0 if it is equal; 1 if it is
    greater */
void SgGtpCommands::CmdCompareInt(GtpCommand& cmd)
{
    int value = cmd.Arg<int>(0);
    string response = m_engine.ExecuteCommand(cmd.RemainingLine(0));
    istringstream in(response);
    int responseValue;
    in >> responseValue;
    if (! in)
        throw GtpFailure() << "response '" << response
                           << "' is not an integer";
    if (responseValue == value)
        cmd << "0";
    else if (responseValue < value)
        cmd << "-1";
    else
        cmd << "1";
}
开发者ID:cbordeman,项目名称:gameofgo,代码行数:21,代码来源:SgGtpCommands.cpp


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