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

#include <search.h>

+ Inheritance diagram for bSearchAlgorithm:
+ Collaboration diagram for bSearchAlgorithm:

Public Member Functions

 bSearchAlgorithm (std::string const &s)
 
 ~bSearchAlgorithm () override
 
 bSearchAlgorithm (bSearchAlgorithm const &)=delete
 
 bSearchAlgorithm (bSearchAlgorithm &&)=delete
 
bSearchAlgorithmoperator= (bSearchAlgorithm const &)=delete
 
bSearchAlgorithmoperator= (bSearchAlgorithm &&)=delete
 
constexpr int64_t getNodes () const
 
constexpr int64_t getNonLeafNodes () const
 
void StartSearch (bScore const sc)
 
void StopSearch ()
 
void InterruptSearch ()
 
void SearchBestMove (bBoard &b, bMoveList &ml)
 Generic search, will call (non-)recursive method per algorithm only when there are moves to be played.
 
void sendInfoSearching (bBoard const &b, depth_t const nDepth, std::string const &comment) const
 
bScore sendInfoSearching (bBoard const &b, depth_t const nDepth, std::string const &comment, bScore const sc) const
 
bScore RetrieveBoardEvaluation (bBoard &b, gameResult_t const gr=GR_UNSET) const
 Get score of board, eventually from cache.
 
constexpr bool isNoBench () const
 
void setBench ()
 
void clearBench ()
 
 operator std::string () const &
 
- Public Member Functions inherited from TimedExecution
 TimedExecution ()
 implementation of timing functions
 
virtual ~TimedExecution ()=default
 
std::string getDuration () const
 
long long getDurationMicroSec () const
 

Public Attributes

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

Protected Member Functions

virtual bScore CalcBestMove (bBoard &b, bMoveList &ml)=0
 
void CheckIfAbortingSearch () const
 
void adjustMaxSearchedDepth (depth_t const nDepth)
 
constexpr depth_t getMaxSearchedDepth () const
 
void initMaxSearchedDepth ()
 
void setLevel (bLevel *l)
 
bLevelgetLevel ()
 
void sendInfoCurrMove (bBoard const &b, depth_t const nCurDepth, bMove const &m, movenum_t const moveid) const
 
- Protected Member Functions inherited from TimedExecution
void ClockStart ()
 
void ClockEnd ()
 
long long getDurationSec () const
 
long long getDurationMilliSec () const
 

Detailed Description

Definition at line 73 of file search.h.

Constructor & Destructor Documentation

◆ bSearchAlgorithm() [1/3]

◆ ~bSearchAlgorithm()

bSearchAlgorithm::~bSearchAlgorithm ( )
inlineoverride

Definition at line 82 of file search.h.

◆ bSearchAlgorithm() [2/3]

bSearchAlgorithm::bSearchAlgorithm ( bSearchAlgorithm const & )
delete
+ Here is the call graph for this function:

◆ bSearchAlgorithm() [3/3]

bSearchAlgorithm::bSearchAlgorithm ( bSearchAlgorithm && )
delete
+ Here is the call graph for this function:

Member Function Documentation

◆ operator=() [1/2]

bSearchAlgorithm & bSearchAlgorithm::operator= ( bSearchAlgorithm const & )
delete
+ Here is the call graph for this function:

◆ operator=() [2/2]

bSearchAlgorithm & bSearchAlgorithm::operator= ( bSearchAlgorithm && )
delete
+ Here is the call graph for this function:

◆ getNodes()

int64_t bSearchAlgorithm::getNodes ( ) const
inlineconstexpr

Definition at line 91 of file search.h.

Referenced by bGame::DoPerft().

+ Here is the caller graph for this function:

◆ getNonLeafNodes()

int64_t bSearchAlgorithm::getNonLeafNodes ( ) const
inlineconstexpr

Definition at line 93 of file search.h.

Referenced by cmd_perft::execute(), and bel_debug::run_bench().

+ Here is the caller graph for this function:

◆ StartSearch()

void bSearchAlgorithm::StartSearch ( bScore const sc)

Definition at line 157 of file search.cpp.

Referenced by SearchBestMove().

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

◆ StopSearch()

void bSearchAlgorithm::StopSearch ( )
inline

Definition at line 97 of file search.h.

Referenced by SearchBestMove().

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

◆ InterruptSearch()

void bSearchAlgorithm::InterruptSearch ( )
inline

Definition at line 101 of file search.h.

Referenced by bGame::AbortSearch().

+ Here is the caller graph for this function:

◆ SearchBestMove()

void bSearchAlgorithm::SearchBestMove ( bBoard & b,
bMoveList & ml )

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

Parameters
binitial board
mlmovelist of this position
Todo
Add debug manipulator

Definition at line 18 of file search.cpp.

Referenced by bGame::DoPerft(), bGame::getEpdMoveInPosition(), and bGame::WaitForSearchEnd().

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

◆ sendInfoSearching() [1/2]

void bSearchAlgorithm::sendInfoSearching ( bBoard const & b,
depth_t const nDepth,
std::string const & comment ) const

Definition at line 191 of file search.cpp.

+ Here is the call graph for this function:

◆ sendInfoSearching() [2/2]

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

Definition at line 205 of file search.cpp.

+ Here is the call graph for this function:

◆ RetrieveBoardEvaluation()

bScore bSearchAlgorithm::RetrieveBoardEvaluation ( bBoard & b,
gameResult_t const gr = GR_UNSET ) const

Get score of board, eventually from cache.

Parameters
bboard
grprevious gameresult
Returns
score of board, either from cache, from gr or caclulated

Definition at line 242 of file search.cpp.

Referenced by SearchAlphaBeta::CalcBestMove(), SearchAlphaBetaFH::CalcBestMove(), SearchEvalPosOnly::CalcBestMove(), and SearchAlphaBeta::Quiescence().

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

◆ isNoBench()

bool bSearchAlgorithm::isNoBench ( ) const
inlineconstexpr

Definition at line 114 of file search.h.

Referenced by SearchAlphaBeta::CalcBestMove(), SearchAlphaBeta::Quiescence(), and SearchBestMove().

+ Here is the caller graph for this function:

◆ setBench()

void bSearchAlgorithm::setBench ( )
inline

Definition at line 116 of file search.h.

Referenced by bGame::DoPerft().

+ Here is the caller graph for this function:

◆ clearBench()

void bSearchAlgorithm::clearBench ( )
inline

Definition at line 118 of file search.h.

Referenced by bGame::DoPerft().

+ Here is the caller graph for this function:

◆ operator std::string()

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

Definition at line 121 of file search.h.

◆ CalcBestMove()

virtual bScore bSearchAlgorithm::CalcBestMove ( bBoard & b,
bMoveList & ml )
protectedpure virtual

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

Referenced by SearchBestMove().

+ Here is the caller graph for this function:

◆ CheckIfAbortingSearch()

void bSearchAlgorithm::CheckIfAbortingSearch ( ) const
protected
Todo
: limit calls to getDurationMilliSec

Definition at line 168 of file search.cpp.

Referenced by SearchAlphaBeta::CalcBestMove(), SearchAlphaBetaFH::CalcBestMove(), SearchEvalPosOnly::CalcBestMove(), and SearchAlphaBeta::Quiescence().

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

◆ adjustMaxSearchedDepth()

void bSearchAlgorithm::adjustMaxSearchedDepth ( depth_t const nDepth)
inlineprotected

◆ getMaxSearchedDepth()

depth_t bSearchAlgorithm::getMaxSearchedDepth ( ) const
inlineconstexprprotected

Definition at line 134 of file search.h.

◆ initMaxSearchedDepth()

void bSearchAlgorithm::initMaxSearchedDepth ( )
inlineprotected

Definition at line 136 of file search.h.

Referenced by SearchBestMove().

+ Here is the caller graph for this function:

◆ setLevel()

void bSearchAlgorithm::setLevel ( bLevel * l)
inlineprotected

Definition at line 139 of file search.h.

Referenced by StartSearch().

+ Here is the caller graph for this function:

◆ getLevel()

bLevel * bSearchAlgorithm::getLevel ( )
inlineprotected

◆ sendInfoCurrMove()

void bSearchAlgorithm::sendInfoCurrMove ( bBoard const & b,
depth_t const nCurDepth,
bMove const & m,
movenum_t const moveid ) const
protected

Member Data Documentation

◆ m_leafnodes

◆ m_nonleafnodes

◆ m_iterativesearch

bool bSearchAlgorithm::m_iterativesearch = false