Thread state for GoUctSearch. More...
#include <GoUctSearch.h>
Classes | |
class | AssertionHandler |
Assertion handler to dump the state of a GoUctState. More... | |
Public Member Functions | |
GoUctState (unsigned int threadId, const GoBoard &bd) | |
Constructor. | |
const GoBoard & | Board () const |
Board used during in-tree phase. | |
const GoUctBoard & | UctBoard () const |
Board used during playout phase. | |
bool | IsInPlayout () const |
std::size_t | GameLength () const |
Length of the current game from the root position of the search. | |
void | Dump (std::ostream &out) const |
virtual SgUctValue | Evaluate ()=0 |
virtual bool | GenerateAllMoves (SgUctValue count, std::vector< SgUctMoveInfo > &moves, SgUctProvenType &provenType)=0 |
virtual SgMove | GeneratePlayoutMove (bool &skipRaveUpdate)=0 |
virtual void | EndPlayout () |
Pure virtual functions of SgUctThreadState | |
void | StartSearch () |
void | Execute (SgMove move) |
Implementation of SgUctSearch::Execute. | |
void | ExecutePlayout (SgMove move) |
Implementation of SgUctSearch::ExecutePlayout. | |
void | TakeBackInTree (std::size_t nuMoves) |
void | TakeBackPlayout (std::size_t nuMoves) |
Virtual functions of SgUctThreadState | |
void | GameStart () |
void | StartPlayout () |
void | StartPlayouts () |
Public Attributes | |
const unsigned int | m_threadId |
bool | m_isSearchInitialized |
bool | m_isTreeOutOfMem |
SgUctGameInfo | m_gameInfo |
boost::scoped_array< std::size_t > | m_firstPlay |
boost::scoped_array< std::size_t > | m_firstPlayOpp |
std::vector< SgUctMoveInfo > | m_moves |
std::vector< SgMove > | m_excludeMoves |
int | m_randomizeCounter |
Private Attributes | |
AssertionHandler | m_assertionHandler |
GoBoard | m_bd |
Board used for in-tree phase. | |
GoUctBoard | m_uctBd |
Board used for playout phase. | |
GoBoardSynchronizer | m_synchronizer |
bool | m_isInPlayout |
std::size_t | m_gameLength |
See GameLength(). |
Thread state for GoUctSearch.
Definition at line 22 of file GoUctSearch.h.
GoUctState::GoUctState | ( | unsigned int | threadId, | |
const GoBoard & | bd | |||
) |
Constructor.
threadId | The number of the thread. Needed for passing to constructor of SgUctThreadState. | |
bd | The board with the current position. The state has is own board that will be synchronized with the currently searched position in StartSearch() |
Definition at line 98 of file GoUctSearch.cpp.
References m_bd, m_isInPlayout, m_synchronizer, and GoBoardSynchronizer::SetSubscriber().
const GoBoard & GoUctState::Board | ( | ) | const |
Board used during in-tree phase.
Definition at line 106 of file GoUctSearch.h.
References m_bd.
Referenced by GoUctGlobalSearchState< POLICY >::Evaluate(), GoUctGlobalSearchState< POLICY >::GenerateLegalMoves(), GoUctGlobalSearchState< POLICY >::GetKomi(), GoUctGlobalSearchState< POLICY >::StartPlayout(), and GoUctGlobalSearchState< POLICY >::StartSearch().
void GoUctState::Dump | ( | std::ostream & | out | ) | const |
Definition at line 108 of file GoUctSearch.cpp.
References m_bd, m_isInPlayout, SgUctThreadState::m_threadId, and m_uctBd.
Referenced by GoUctState::AssertionHandler::Run().
void GoUctState::Execute | ( | SgMove | move | ) | [virtual] |
Implementation of SgUctSearch::Execute.
Implements SgUctThreadState.
Definition at line 117 of file GoUctSearch.cpp.
References GO_MOVEFLAG_ILLEGAL, GoBoard::LastMoveInfo(), m_bd, m_gameLength, m_isInPlayout, GoBoard::Occupied(), GoBoard::Play(), GoBoard::Rules(), GoRules::SetKoRule(), SG_ASSERT, SG_PASS, and GoRules::SIMPLEKO.
void GoUctState::ExecutePlayout | ( | SgMove | move | ) | [virtual] |
Implementation of SgUctSearch::ExecutePlayout.
Implements SgUctThreadState.
Reimplemented in GoUctGlobalSearchState< POLICY >.
Definition at line 130 of file GoUctSearch.cpp.
References m_gameLength, m_isInPlayout, m_uctBd, GoUctBoard::Occupied(), GoUctBoard::Play(), SG_ASSERT, and SG_PASS.
std::size_t GoUctState::GameLength | ( | ) | const |
Length of the current game from the root position of the search.
Definition at line 111 of file GoUctSearch.h.
References m_gameLength.
Referenced by GoUctGlobalSearchState< POLICY >::EvaluateBoard().
void GoUctState::GameStart | ( | ) | [virtual] |
Reimplemented from SgUctThreadState.
Reimplemented in GoUctGlobalSearchState< POLICY >.
Definition at line 138 of file GoUctSearch.cpp.
References m_gameLength, and m_isInPlayout.
bool GoUctState::IsInPlayout | ( | ) | const |
Definition at line 116 of file GoUctSearch.h.
References m_isInPlayout.
Referenced by GoUctGlobalSearchState< POLICY >::CheckMercyRule(), GoUctGlobalSearchState< POLICY >::Evaluate(), and GoUctGlobalSearchState< POLICY >::GeneratePlayoutMove().
void GoUctState::StartPlayout | ( | ) | [virtual] |
Reimplemented from SgUctThreadState.
Reimplemented in GoUctGlobalSearchState< POLICY >.
Definition at line 144 of file GoUctSearch.cpp.
References GoUctBoard::Init(), m_bd, and m_uctBd.
void GoUctState::StartPlayouts | ( | ) | [virtual] |
Reimplemented from SgUctThreadState.
Reimplemented in GoUctGlobalSearchState< POLICY >.
Definition at line 149 of file GoUctSearch.cpp.
References m_isInPlayout.
void GoUctState::StartSearch | ( | ) | [virtual] |
Implements SgUctThreadState.
Reimplemented in GoUctGlobalSearchState< POLICY >.
Definition at line 154 of file GoUctSearch.cpp.
References m_synchronizer, and GoBoardSynchronizer::UpdateSubscriber().
void GoUctState::TakeBackInTree | ( | std::size_t | nuMoves | ) | [virtual] |
Implements SgUctThreadState.
Definition at line 159 of file GoUctSearch.cpp.
References m_bd, and GoBoard::Undo().
void GoUctState::TakeBackPlayout | ( | std::size_t | nuMoves | ) | [virtual] |
Implements SgUctThreadState.
Definition at line 165 of file GoUctSearch.cpp.
References m_gameLength.
const GoUctBoard & GoUctState::UctBoard | ( | ) | const |
Board used during playout phase.
Definition at line 121 of file GoUctSearch.h.
References m_uctBd.
Referenced by GoUctGlobalSearchState< POLICY >::CheckMercyRule(), GoUctGlobalSearchState< POLICY >::Evaluate(), GoUctGlobalSearchState< POLICY >::ExecutePlayout(), and GoUctGlobalSearchState< POLICY >::GeneratePlayoutMove().
Definition at line 90 of file GoUctSearch.h.
GoBoard GoUctState::m_bd [private] |
Board used for in-tree phase.
Definition at line 93 of file GoUctSearch.h.
Referenced by Board(), Dump(), Execute(), GoUctState(), StartPlayout(), and TakeBackInTree().
std::size_t GoUctState::m_gameLength [private] |
See GameLength().
Definition at line 103 of file GoUctSearch.h.
Referenced by Execute(), ExecutePlayout(), GameLength(), GameStart(), and TakeBackPlayout().
bool GoUctState::m_isInPlayout [private] |
Definition at line 100 of file GoUctSearch.h.
Referenced by Dump(), Execute(), ExecutePlayout(), GameStart(), GoUctState(), IsInPlayout(), and StartPlayouts().
Definition at line 98 of file GoUctSearch.h.
Referenced by GoUctState(), and StartSearch().
GoUctBoard GoUctState::m_uctBd [private] |
Board used for playout phase.
Definition at line 96 of file GoUctSearch.h.
Referenced by Dump(), ExecutePlayout(), StartPlayout(), and UctBoard().