示例#1
0
/** 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.IntArg(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";
}
示例#2
0
/** 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));
}