Commands for building/inspecting virtual connections. More...
#include <DfsCommands.hpp>
Public Member Functions | |
DfsCommands (Game &game, HexEnvironment &env, DfsSolver &solver, boost::scoped_ptr< DfsHashTable > &tt, boost::scoped_ptr< DfsDB > &db, DfsStates &positions) | |
void | Register (GtpEngine &engine) |
Private Member Functions | |
void | Register (GtpEngine &engine, const std::string &command, GtpCallback< DfsCommands >::Method method) |
void | CmdParamSolver (HtpCommand &cmd) |
void | CmdParamSolverDB (HtpCommand &cmd) |
void | CmdSolveState (HtpCommand &cmd) |
Solves the given state. | |
void | CmdSolverClearTT (HtpCommand &cmd) |
Clears the current TT. | |
void | CmdSolverFindWinning (HtpCommand &cmd) |
Finds all winning moves in this state by calling 'solve-state' on each child move. | |
void | CmdDBOpen (HtpCommand &cmd) |
Opens a database. | |
void | CmdDBClose (HtpCommand &cmd) |
Closes an open database. | |
void | CmdDBStat (HtpCommand &cmd) |
Prints database statistics. | |
void | CmdGetState (HtpCommand &cmd) |
Dumps info from on current state. | |
void | CmdGetPV (HtpCommand &cmd) |
Prints PV from the current state from the last search. | |
void | CmdHistogram (HtpCommand &cmd) |
Prints histogram of last search. | |
Private Attributes | |
Game & | m_game |
HexEnvironment & | m_env |
DfsSolver & | m_solver |
boost::scoped_ptr< DfsHashTable > & | m_tt |
boost::scoped_ptr< DfsDB > & | m_db |
DfsStates & | m_positions |
Commands for building/inspecting virtual connections.
Definition at line 20 of file DfsCommands.hpp.
DfsCommands::DfsCommands | ( | Game & | game, | |
HexEnvironment & | env, | |||
DfsSolver & | solver, | |||
boost::scoped_ptr< DfsHashTable > & | tt, | |||
boost::scoped_ptr< DfsDB > & | db, | |||
DfsStates & | positions | |||
) |
Definition at line 16 of file DfsCommands.cpp.
void DfsCommands::CmdDBClose | ( | HtpCommand & | cmd | ) | [private] |
Closes an open database.
Definition at line 226 of file DfsCommands.cpp.
References m_db.
Referenced by Register().
void DfsCommands::CmdDBOpen | ( | HtpCommand & | cmd | ) | [private] |
Opens a database.
Usage: "db-open [filename]"
Definition at line 212 of file DfsCommands.cpp.
References m_db, and BenzeneException::what().
Referenced by Register().
void DfsCommands::CmdDBStat | ( | HtpCommand & | cmd | ) | [private] |
Prints database statistics.
Definition at line 289 of file DfsCommands.cpp.
References m_db.
Referenced by Register().
void DfsCommands::CmdGetPV | ( | HtpCommand & | cmd | ) | [private] |
Prints PV from the current state from the last search.
Definition at line 305 of file DfsCommands.cpp.
References Game::Board(), HtpUtil::ColorArg(), SolverDBUtil::GetVariation(), m_game, m_positions, and HexPointUtil::ToString().
Referenced by Register().
void DfsCommands::CmdGetState | ( | HtpCommand & | cmd | ) | [private] |
Dumps info from on current state.
Definition at line 235 of file DfsCommands.cpp.
References BITSETSIZE, Game::Board(), SolverDB< HASH, DB, DATA >::Get(), m_game, m_positions, SolverDataFlags::MIRROR_TRANSPOSITION, SolverDataFlags::TRANSPOSITION, and StoneBoard::WhoseTurn().
Referenced by Register().
void DfsCommands::CmdHistogram | ( | HtpCommand & | cmd | ) | [private] |
Prints histogram of last search.
Definition at line 298 of file DfsCommands.cpp.
References DfsSolver::Histogram(), m_solver, and DfsHistogram::Write().
Referenced by Register().
void DfsCommands::CmdParamSolver | ( | HtpCommand & | cmd | ) | [private] |
Definition at line 84 of file DfsCommands.cpp.
References DfsSolver::BackupIceInfo(), DfsHashTable, m_solver, m_tt, DfsSolver::MoveOrdering(), DfsSolver::SetBackupIceInfo(), DfsSolver::SetMoveOrdering(), DfsSolver::SetShrinkProofs(), DfsSolver::SetUpdateDepth(), DfsSolver::SetUseDecompositions(), DfsSolver::SetUseGuiFx(), DfsSolver::ShrinkProofs(), DfsSolver::UpdateDepth(), DfsSolver::UseDecompositions(), and DfsSolver::UseGuiFx().
Referenced by Register().
void DfsCommands::CmdParamSolverDB | ( | HtpCommand & | cmd | ) | [private] |
Definition at line 54 of file DfsCommands.cpp.
References SolverDBParameters::m_maxStones, m_positions, SolverDBParameters::m_transStones, SolverDBParameters::m_useFlippedStates, SolverDBParameters::m_useProofTranspositions, and SolverDB< HASH, DB, DATA >::Parameters().
Referenced by Register().
void DfsCommands::CmdSolverClearTT | ( | HtpCommand & | cmd | ) | [private] |
Clears the current TT.
Definition at line 154 of file DfsCommands.cpp.
References m_tt, and UNUSED().
Referenced by Register().
void DfsCommands::CmdSolverFindWinning | ( | HtpCommand & | cmd | ) | [private] |
Finds all winning moves in this state by calling 'solve-state' on each child move.
Usage: same as 'solve-state'.
Definition at line 164 of file DfsCommands.cpp.
References Game::Board(), HtpUtil::ColorArg(), HexBoard::ComputeAll(), DfsSolver::DumpStats(), EMPTY, ICEngine::FindPermanentlyInferior(), StoneBoard::GetEmpty(), HexBoard::GetPosition(), HexBoard::ICE(), EndgameUtils::IsDeterminedState(), LogInfo(), m_env, m_game, m_positions, m_solver, EndgameUtils::MovesToConsider(), DfsSolutionSet::proof, benzene_bitset< _Nb >::set(), DfsSolver::Solve(), HexEnvironment::SyncBoard(), benzene_bitset< _Nb >::test(), HexPointUtil::ToString(), and StoneBoard::Write().
Referenced by Register().
void DfsCommands::CmdSolveState | ( | HtpCommand & | cmd | ) | [private] |
Solves the given state.
Usage: "solve-state [color to play]
Definition at line 135 of file DfsCommands.cpp.
References Game::Board(), HtpUtil::ColorArg(), DfsSolver::DumpStats(), EMPTY, ICEngine::FindPermanentlyInferior(), HexBoard::ICE(), LogInfo(), m_env, m_game, m_positions, m_solver, DfsSolver::Solve(), HexEnvironment::SyncBoard(), and HexBoard::Write().
Referenced by Register().
void DfsCommands::Register | ( | GtpEngine & | engine, | |
const std::string & | command, | |||
GtpCallback< DfsCommands >::Method | method | |||
) | [private] |
Definition at line 46 of file DfsCommands.cpp.
void DfsCommands::Register | ( | GtpEngine & | engine | ) |
Definition at line 30 of file DfsCommands.cpp.
References CmdDBClose(), CmdDBOpen(), CmdDBStat(), CmdGetPV(), CmdGetState(), CmdHistogram(), CmdParamSolver(), CmdParamSolverDB(), CmdSolverClearTT(), CmdSolverFindWinning(), and CmdSolveState().
Referenced by BenzeneHtpEngine::BenzeneHtpEngine().
boost::scoped_ptr<DfsDB>& DfsCommands::m_db [private] |
Definition at line 39 of file DfsCommands.hpp.
Referenced by CmdDBClose(), CmdDBOpen(), and CmdDBStat().
HexEnvironment& DfsCommands::m_env [private] |
Definition at line 33 of file DfsCommands.hpp.
Referenced by CmdSolverFindWinning(), and CmdSolveState().
Game& DfsCommands::m_game [private] |
Definition at line 31 of file DfsCommands.hpp.
Referenced by CmdGetPV(), CmdGetState(), CmdSolverFindWinning(), and CmdSolveState().
DfsStates& DfsCommands::m_positions [private] |
Definition at line 41 of file DfsCommands.hpp.
Referenced by CmdGetPV(), CmdGetState(), CmdParamSolverDB(), CmdSolverFindWinning(), and CmdSolveState().
DfsSolver& DfsCommands::m_solver [private] |
Definition at line 35 of file DfsCommands.hpp.
Referenced by CmdHistogram(), CmdParamSolver(), CmdSolverFindWinning(), and CmdSolveState().
boost::scoped_ptr<DfsHashTable>& DfsCommands::m_tt [private] |
Definition at line 37 of file DfsCommands.hpp.
Referenced by CmdParamSolver(), and CmdSolverClearTT().