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


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

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


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

示例1: CmdGfx

/** Information about safe points optimized for graphical display in GoGui.
    This command is compatible with GoGui's analyze command type "gfx".
    Arguments: benson|static <br>
    Returns: GoGui gfx commands to display safe points and additional
    information in the status line
    - black and white territory: safe points
    - Color Magenta (#980098): dame points
    - Color Red: safe for black and white (should not happen)
    - Circle: unsurroundable
    - Status line: point counts, percentage of safe points
*/
void GoSafetyCommands::CmdGfx(GtpCommand& cmd)
{
    cmd.CheckNuArg(1);
    string type = cmd.Arg(0);
    int totalRegions = 0;
    SgBWSet safe = GetSafe(totalRegions, type);
    SgPointSet dame;
    SgPointSet unsurroundable;
    GoSafetyUtil::FindDameAndUnsurroundablePoints(m_bd, m_bd.AllEmpty(), safe,
                                                  &dame, &unsurroundable);
    cmd << "BLACK";
    for (SgSetIterator it(safe[SG_BLACK]); it; ++it)
        cmd << ' ' << SgWritePoint(*it);
    cmd << '\n';
    cmd << "WHITE";
    for (SgSetIterator it(safe[SG_WHITE]); it; ++it)
        cmd << ' ' << SgWritePoint(*it);
    cmd << '\n';
    cmd << "COLOR #980098";
    for (SgSetIterator it(dame); it; ++it)
        cmd << ' ' << SgWritePoint(*it);
    cmd << '\n';
    cmd << "CIRCLE";
    for (SgSetIterator it(unsurroundable); it; ++it)
        cmd << ' ' << SgWritePoint(*it);
    cmd << '\n';
    SgPointSet blackAndWhite = safe[SG_WHITE] & safe[SG_BLACK];
    if (blackAndWhite.Size() > 0)
    {
        // Shouldn't happen
        cmd << "COLOR red ";
        for (SgSetIterator it(blackAndWhite); it; ++it)
            cmd << ' ' << SgWritePoint(*it);
        cmd << '\n';
    }
    int nuBlack = safe[SG_BLACK].Size();
    int nuWhite = safe[SG_WHITE].Size();
    int nuPoints = m_bd.AllPoints().Size();
    cmd << "TEXT Solver: " << cmd.Arg(0)
        << "  B: " << nuBlack << " (" << (100 * nuBlack / nuPoints) << " %)"
        << "  W: " << nuWhite << " (" << (100 * nuWhite / nuPoints) << " %)"
        << "  Both: " << (nuBlack + nuWhite)
        << " (" << (100 * (nuBlack + nuWhite) / nuPoints) << " %)"
        << "  Regions: " << totalRegions;
}
开发者ID:ernest-galbrun,项目名称:fuegoia,代码行数:56,代码来源:GoSafetyCommands.cpp

示例2: CmdDebugger

/** Run a debugger and attach it to the current program.
    Arguments: debugger-type <br>
    Currently implemented debugger types:
    - gdb_kde GDB in KDE terminal
    - gdb_gnome GDB in GNOME terminal
*/
void SgGtpCommands::CmdDebugger(GtpCommand& cmd)
{
    cmd.CheckNuArg(1);
    string type = cmd.Arg(0);
    const char* path = m_programPath;
    if (path == 0)
        throw GtpFailure("location of executable unknown");
    pid_t pid = getpid();
    ostringstream s;
    if (type == "gdb_kde")
        s << "konsole -e gdb " << path << ' ' << pid << " &";
    else if (type == "gdb_gnome")
        s << "gnome-terminal -e 'gdb " << path << ' ' << pid << "' &";
    else
        throw GtpFailure() << "unknown debugger: " << type;
    SgDebug() << "Executing: " << s.str() << '\n';
    int retval = system(s.str().c_str());
    if (retval != 0)
        throw GtpFailure() << "command returned " << retval;
}
开发者ID:,项目名称:,代码行数:26,代码来源:

示例3: PointArg

SgPoint GoGtpCommandUtil::PointArg(const GtpCommand& cmd,
                                   const GoBoard& board)
{
    cmd.CheckNuArg(1);
    return PointArg(cmd, 0, board);
}
开发者ID:Nopik,项目名称:dragongoclient,代码行数:6,代码来源:GoGtpCommandUtil.cpp

示例4: SetSeed

/** Set and store random seed.
    Arguments: seed <br>
    See SgRandom::SetSeed(int) for the special meaning of zero and negative
    values.
*/
void SgGtpCommands::CmdSetRandomSeed(GtpCommand& cmd)
{
    cmd.CheckNuArg(1);
    SgRandom::SetSeed(cmd.IntArg(0));
}
开发者ID:,项目名称:,代码行数:10,代码来源:

示例5: CmdExec

/** Execute GTP commands from a file.
    Argument: filename <br>
    Aborts on the first command that fails. Responses to the commands in the
    file are written to SgDebug()
    @see GtpEngine::ExecuteFile
*/
void SgGtpCommands::CmdExec(GtpCommand& cmd)
{
    cmd.CheckNuArg(1);
    m_engine.ExecuteFile(cmd.Arg(0), SgDebug());
}
开发者ID:,项目名称:,代码行数:11,代码来源:


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