本文整理汇总了C++中GtpCommand::IntArg方法的典型用法代码示例。如果您正苦于以下问题:C++ GtpCommand::IntArg方法的具体用法?C++ GtpCommand::IntArg怎么用?C++ GtpCommand::IntArg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GtpCommand
的用法示例。
在下文中一共展示了GtpCommand::IntArg方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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.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: 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));
}