Player using Solver to generate moves. More...
#include <PerfectPlayer.hpp>
Public Member Functions | |
PerfectPlayer (DfpnSolver &solver, DfpnStates &positions) | |
virtual | ~PerfectPlayer () |
std::string | Name () const |
Returns "perfect". | |
double | MaxTime () const |
Maximum time to use per search. | |
void | SetMaxTime (double time) |
See MaxTime(). | |
bool | PropagateBackwards () const |
See DfpnSolver::PropagateBackwards(). | |
void | SetPropagateBackwards (bool flag) |
See PropagateBackwards(). | |
HexPoint | GenMove (const HexState &state, const Game &game, HexBoard &brd, double maxTime, double &score) |
Generates a move from this board position. | |
bool | SearchSingleton () const |
Search states with only a single move? | |
void | SetSearchSingleton (bool flag) |
See SetSearchSingleton(). | |
Protected Member Functions | |
bool | FillinCausedWin () const |
Protected Attributes | |
bool | m_fillinCausedWin |
HexColor | m_fillinWinner |
Private Member Functions | |
HexPoint | Search (const HexState &state, const Game &game, HexBoard &brd, const bitset_t &consider, double maxTime, double &score) |
Generates a move in the given gamestate using DfpnSolver. | |
Private Attributes | |
DfpnSolver & | m_solver |
DfpnStates & | m_positions |
double | m_maxTime |
bool | m_propagateBackwards |
Player using Solver to generate moves.
Works best on boards 7x7 and smaller.
Definition at line 22 of file PerfectPlayer.hpp.
PerfectPlayer::PerfectPlayer | ( | DfpnSolver & | solver, | |
DfpnStates & | positions | |||
) | [explicit] |
Definition at line 36 of file PerfectPlayer.cpp.
PerfectPlayer::~PerfectPlayer | ( | ) | [virtual] |
Definition at line 45 of file PerfectPlayer.cpp.
bool BenzenePlayer::FillinCausedWin | ( | ) | const [inline, protected, inherited] |
Definition at line 86 of file BenzenePlayer.hpp.
References BenzenePlayer::m_fillinCausedWin.
Referenced by Search().
HexPoint BenzenePlayer::GenMove | ( | const HexState & | state, | |
const Game & | game, | |||
HexBoard & | brd, | |||
double | maxTime, | |||
double & | score | |||
) | [virtual, inherited] |
Generates a move from this board position.
If the game is already over (somebody has won), returns RESIGN.
Derived Benzene players that use different search algorithms should not extend this method, but the protected virtual method Search() below.
If state is terminal (game over, vc/fill-in win/loss), returns "appropriate" move. Otherwise, calls Search().
Implements HexPlayer.
Definition at line 27 of file BenzenePlayer.cpp.
References BenzenePlayer::CheckEndgame(), BenzenePlayer::InitSearch(), INVALID_POINT, LogInfo(), BenzenePlayer::Search(), and HexState::ToPlay().
Referenced by MoHexEngine::DoSearch(), WolveEngine::GenMove(), PlayAndSolve::PlayerThread::operator()(), and BookBuilder< PLAYER >::Worker::operator()().
double PerfectPlayer::MaxTime | ( | ) | const [inline] |
Maximum time to use per search.
Definition at line 65 of file PerfectPlayer.hpp.
References m_maxTime.
Referenced by BenzeneTestEngine::CmdParamPlayer().
std::string PerfectPlayer::Name | ( | ) | const [inline, virtual] |
bool PerfectPlayer::PropagateBackwards | ( | ) | const [inline] |
See DfpnSolver::PropagateBackwards().
Definition at line 75 of file PerfectPlayer.hpp.
References m_propagateBackwards.
Referenced by BenzeneTestEngine::CmdParamPlayer().
HexPoint PerfectPlayer::Search | ( | const HexState & | state, | |
const Game & | game, | |||
HexBoard & | brd, | |||
const bitset_t & | consider, | |||
double | maxTime, | |||
double & | score | |||
) | [private, virtual] |
Generates a move in the given gamestate using DfpnSolver.
Implements BenzenePlayer.
Definition at line 51 of file PerfectPlayer.cpp.
References benzene_bitset< _Nb >::any(), InferiorCells::Captured(), HexBoard::ComputeAll(), EMPTY, BenzenePlayer::FillinCausedWin(), DfpnChildren::FirstMove(), SolverDB< HASH, DB, DATA >::Get(), StoneBoard::GetEmpty(), HexBoard::GetInferiorCells(), HexBoard::GetPosition(), HexAssert, DfpnBounds::IsWinning(), LogInfo(), DfpnData::m_bounds, DfpnData::m_children, BenzenePlayer::m_fillinWinner, m_maxTime, m_positions, m_propagateBackwards, m_solver, DfpnData::m_work, DfpnChildren::PlayMove(), HexState::Position(), DfpnSolver::PropagateBackwards(), StoneBoard::SetPosition(), DfpnSolver::SetTimelimit(), DfpnChildren::Size(), DfpnSolver::StartSearch(), DfpnSolver::Timelimit(), HexState::ToPlay(), and DfpnChildren::UndoMove().
bool BenzenePlayer::SearchSingleton | ( | ) | const [inline, inherited] |
Search states with only a single move?
Definition at line 76 of file BenzenePlayer.hpp.
References BenzenePlayer::m_search_singleton.
Referenced by MoHexEngine::MoHexParam(), and WolveEngine::WolveParam().
void PerfectPlayer::SetMaxTime | ( | double | time | ) | [inline] |
See MaxTime().
Definition at line 70 of file PerfectPlayer.hpp.
References m_maxTime.
Referenced by BenzeneTestEngine::CmdParamPlayer().
void PerfectPlayer::SetPropagateBackwards | ( | bool | flag | ) | [inline] |
See PropagateBackwards().
Definition at line 80 of file PerfectPlayer.hpp.
References m_propagateBackwards.
Referenced by BenzeneTestEngine::CmdParamPlayer().
void BenzenePlayer::SetSearchSingleton | ( | bool | flag | ) | [inline, inherited] |
See SetSearchSingleton().
Definition at line 81 of file BenzenePlayer.hpp.
References BenzenePlayer::m_search_singleton.
Referenced by MoHexEngine::MoHexParam(), and WolveEngine::WolveParam().
bool BenzenePlayer::m_fillinCausedWin [protected, inherited] |
Definition at line 46 of file BenzenePlayer.hpp.
Referenced by BenzenePlayer::FillinCausedWin(), and BenzenePlayer::InitSearch().
HexColor BenzenePlayer::m_fillinWinner [protected, inherited] |
Definition at line 48 of file BenzenePlayer.hpp.
Referenced by BenzenePlayer::InitSearch(), and Search().
double PerfectPlayer::m_maxTime [private] |
Definition at line 50 of file PerfectPlayer.hpp.
Referenced by MaxTime(), Search(), and SetMaxTime().
DfpnStates& PerfectPlayer::m_positions [private] |
Definition at line 48 of file PerfectPlayer.hpp.
Referenced by Search().
bool PerfectPlayer::m_propagateBackwards [private] |
Definition at line 52 of file PerfectPlayer.hpp.
Referenced by PropagateBackwards(), Search(), and SetPropagateBackwards().
DfpnSolver& PerfectPlayer::m_solver [private] |
Definition at line 46 of file PerfectPlayer.hpp.
Referenced by Search().