Belofte  version 2.1.5
A promising chess program using the UCI or Winboard interface
bSearchAlgorithm Class Referenceabstract

Public Member Functions

 bSearchAlgorithm (std::string const &n)
 
 ~bSearchAlgorithm () override
 
 bSearchAlgorithm (bSearchAlgorithm const &)=delete
 
 bSearchAlgorithm (bSearchAlgorithm &&)=delete
 
bSearchAlgorithmoperator= (bSearchAlgorithm const &)=delete
 
bSearchAlgorithmoperator= (bSearchAlgorithm &&)=delete
 
 operator std::string () const
 
int64_t getNodes () const
 
int64_t getNonLeafNodes () const
 
void StopSearch ()
 
void InterruptSearch ()
 
bBestMoveInfo SearchBestMove (bBoard &b)
 Generic search, will call (non-)recursive method per algorithm only when there are moves to be played. More...
 
bScore sendInfoSearching (bBoard const &b, depth_t const nDepth, std::string const &c, bScore const sc) const
 
bScore sendInfoSearching (bBoard const &b, depth_t const nDepth, std::string const &c, bSearchScore const &sc) const
 
bScore RetrieveBoardEvaluation (bBoard &b) const
 Cache score of board. More...
 
- Public Member Functions inherited from TimedExecution
 TimedExecution ()
 implementation of timing functions More...
 
virtual ~TimedExecution ()=default
 
std::string getDuration () const
 
long long getDurationMicroSec () const
 

Public Attributes

depth_t m_maxDepth = 0
 
int64_t m_leafnodes = 0LL
 
int64_t m_nonleafnodes = 0LL
 
bool m_iterativesearch = false
 

Protected Member Functions

virtual bBestMoveInfo CalcBestMove (bBoard &b)=0
 
bScore attenuateScore (bScore const sc) const
 converge score towards zero in order to force immediate best move first More...
 
void setLevel (bLevel *l)
 
bLevelgetLevel ()
 
void handleInfoCurrMove (bBoard const &b, bMoveList const &ml, depth_t const &nDepth, movenum_t const moveid) const
 
bScore sendInfoScore (bBoard const &b, depth_t const nDepth, bScore const) const
 
void dumpMoveList (bBoard &b, depth_t const iDepth) const
 
- Protected Member Functions inherited from TimedExecution
void ClockStart ()
 
void ClockEnd ()
 
int64_t getDurationSec () const
 
int64_t getDurationMilliSec () const
 

Detailed Description

Definition at line 27 of file search.h.

Constructor & Destructor Documentation

◆ bSearchAlgorithm() [1/3]

bSearchAlgorithm::bSearchAlgorithm ( std::string const &  n)
explicit

Definition at line 14 of file search.cpp.

◆ ~bSearchAlgorithm()

bSearchAlgorithm::~bSearchAlgorithm ( )
override

Definition at line 21 of file search.cpp.

◆ bSearchAlgorithm() [2/3]

bSearchAlgorithm::bSearchAlgorithm ( bSearchAlgorithm const &  )
delete

◆ bSearchAlgorithm() [3/3]

bSearchAlgorithm::bSearchAlgorithm ( bSearchAlgorithm &&  )
delete

Member Function Documentation

◆ operator=() [1/2]

bSearchAlgorithm& bSearchAlgorithm::operator= ( bSearchAlgorithm const &  )
delete

◆ operator=() [2/2]

bSearchAlgorithm& bSearchAlgorithm::operator= ( bSearchAlgorithm &&  )
delete

◆ operator std::string()

bSearchAlgorithm::operator std::string ( ) const
inline

Definition at line 38 of file search.h.

◆ getNodes()

int64_t bSearchAlgorithm::getNodes ( ) const
inline

Definition at line 40 of file search.h.

Referenced by bGameWithTest::DoPerft().

+ Here is the caller graph for this function:

◆ getNonLeafNodes()

int64_t bSearchAlgorithm::getNonLeafNodes ( ) const
inline

Definition at line 41 of file search.h.

Referenced by bel_debug::run_bench().

+ Here is the caller graph for this function:

◆ StopSearch()

void bSearchAlgorithm::StopSearch ( )

Definition at line 160 of file search.cpp.

Referenced by SearchBestMove().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InterruptSearch()

void bSearchAlgorithm::InterruptSearch ( )

Definition at line 166 of file search.cpp.

Referenced by bGame::AbortSearch().

+ Here is the caller graph for this function:

◆ SearchBestMove()

bBestMoveInfo bSearchAlgorithm::SearchBestMove ( bBoard b)

Generic search, will call (non-)recursive method per algorithm only when there are moves to be played.

Parameters
binitial board

Definition at line 34 of file search.cpp.

Referenced by bGameWithTest::DoPerft(), bGameWithTest::evalEpdPosition(), and bGame::WaitForSearchEnd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendInfoSearching() [1/2]

bScore bSearchAlgorithm::sendInfoSearching ( bBoard const &  b,
depth_t const  nDepth,
std::string const &  c,
bScore const  sc 
) const

Definition at line 191 of file search.cpp.

Referenced by SearchEvalPosOnly::CalcBestMove(), and TerminalNode::TerminalNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendInfoSearching() [2/2]

bScore bSearchAlgorithm::sendInfoSearching ( bBoard const &  b,
depth_t const  nDepth,
std::string const &  c,
bSearchScore const &  sc 
) const

Definition at line 206 of file search.cpp.

+ Here is the call graph for this function:

◆ RetrieveBoardEvaluation()

bScore bSearchAlgorithm::RetrieveBoardEvaluation ( bBoard b) const

Cache score of board.

Parameters
bboard

Definition at line 248 of file search.cpp.

Referenced by SearchEvalPosOnly::CalcBestMove(), SearchBestMove(), and TerminalNode::TerminalNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CalcBestMove()

virtual bBestMoveInfo bSearchAlgorithm::CalcBestMove ( bBoard b)
protectedpure virtual

Implemented in SearchRandom, SearchEvalPosOnly, SearchPerft, SearchBruteForce, and SearchAlphaBeta.

Referenced by SearchBestMove().

+ Here is the caller graph for this function:

◆ attenuateScore()

bScore bSearchAlgorithm::attenuateScore ( bScore const  sc) const
protected

converge score towards zero in order to force immediate best move first

Definition at line 261 of file search.cpp.

◆ setLevel()

void bSearchAlgorithm::setLevel ( bLevel l)
inlineprotected

Definition at line 65 of file search.h.

◆ getLevel()

bLevel* bSearchAlgorithm::getLevel ( )
inlineprotected

Definition at line 66 of file search.h.

Referenced by SearchPerft::CalcBestMove(), and SearchBestMove().

+ Here is the caller graph for this function:

◆ handleInfoCurrMove()

void bSearchAlgorithm::handleInfoCurrMove ( bBoard const &  b,
bMoveList const &  ml,
depth_t const &  nDepth,
movenum_t const  moveid 
) const
protected

Definition at line 232 of file search.cpp.

Referenced by SearchEvalPosOnly::CalcBestMove(), and SearchRandom::CalcBestMove().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendInfoScore()

bScore bSearchAlgorithm::sendInfoScore ( bBoard const &  b,
depth_t const  nDepth,
bScore const  sc 
) const
protected

Definition at line 221 of file search.cpp.

Referenced by SearchBestMove().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dumpMoveList()

void bSearchAlgorithm::dumpMoveList ( bBoard b,
depth_t const  iDepth 
) const
protected

Definition at line 181 of file search.cpp.

Referenced by SearchBestMove().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_maxDepth

depth_t bSearchAlgorithm::m_maxDepth = 0

◆ m_leafnodes

int64_t bSearchAlgorithm::m_leafnodes = 0LL

◆ m_nonleafnodes

int64_t bSearchAlgorithm::m_nonleafnodes = 0LL

◆ m_iterativesearch

bool bSearchAlgorithm::m_iterativesearch = false