Пример #1
0
void GoBookCommands::CmdMoves(GtpCommand& cmd)
{
    cmd.CheckArgNone();
    vector<SgPoint> active = m_book.LookupAllMoves(m_bd);
    for (vector<SgPoint>::const_iterator it = active.begin();
         it != active.end(); ++it)
        cmd << SgWritePoint(*it) << ' ';
}
Пример #2
0
/** Return the process ID. */
void SgGtpCommands::CmdPid(GtpCommand& cmd)
{
#if WIN32
    throw GtpFailure("command not implemented on Windows");
#else
    cmd.CheckArgNone();
    cmd << getpid();
#endif
}
Пример #3
0
/** Return dame points after running static safety algorithm. */
void GoSafetyCommands::CmdDameStatic(GtpCommand& cmd)
{
    cmd.CheckArgNone();
    GoModBoard modBoard(m_bd);
    GoBoard& bd = modBoard.Board();
    GoRegionBoard regionAttachment(bd);
    GoSafetySolver solver(bd, &regionAttachment);
    SgBWSet safe;
    solver.FindSafePoints(&safe);
    SgPointSet dame = GoSafetyUtil::FindDamePoints(bd, m_bd.AllEmpty(), safe);
    cmd << SgWritePointSet(dame, "", false);
}
Пример #4
0
void GoBookCommands::CmdSave(GtpCommand& cmd)
{
    if (m_engine.MpiSynchronizer()->IsRootProcess())
    {
    cmd.CheckArgNone();
    if (m_fileName == "")
        throw GtpFailure("no filename associated with current book");
    ofstream out(m_fileName.c_str());
    m_book.Write(out);
    if (! out)
    {
        throw GtpFailure() << "error writing to file '" << m_fileName << "'";
    }
    }
}
Пример #5
0
/** Show book information for current positions.
    This command is compatible with the GoGui analyze command type "gfx".
    Moves in the book for the current position are marked with a green
    color (active moves), moves that lead to a known position in the book
    with yellow (other moves). The status line shows the line number of the
    position in the file (0, if unknown) and the number of active and other
    moves. */
void GoBookCommands::CmdPosition(GtpCommand& cmd)
{
    cmd.CheckArgNone();
    PositionInfo(cmd);
}
Пример #6
0
/** Show information about current book. */
void GoBookCommands::CmdInfo(GtpCommand& cmd)
{
    cmd.CheckArgNone();
    cmd << SgWriteLabel("FileName") << m_fileName << '\n';
    m_book.WriteInfo(cmd);
}
Пример #7
0
void GoBookCommands::CmdClear(GtpCommand& cmd)
{
    cmd.CheckArgNone();
    m_book.Clear();
}
Пример #8
0
/** Return the current random seed.
    See SgRandom::SetSeed(int) for the special meaning of zero and negative
    values. */
void SgGtpCommands::CmdGetRandomSeed(GtpCommand& cmd)
{
    cmd.CheckArgNone();
    cmd << SgRandom::Seed();
}
Пример #9
0
/** Return the process ID. */
void SgGtpCommands::CmdPid(GtpCommand& cmd)
{
    cmd.CheckArgNone();
    cmd << getpid();
}