Belofte version 2.1.8
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 &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 StartSearch (bScore const m)
 
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.
 
bScore sendInfoSearching (bBoard const &b, depth_t const nDepth, std::string const &c, bScore const sc) const
 
bScore RetrieveBoardEvaluation (bBoard &b) const
 Cache score of board.
 
- Public Member Functions inherited from TimedExecution
 TimedExecution ()
 implementation of timing functions
 
virtual ~TimedExecution ()=default
 
std::string getDuration () const
 
long long getDurationMicroSec () const
 

Public Attributes

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

Protected Member Functions

virtual bScore CalcBestMove (bBoard &b)=0
 
void CheckIfAbortingSearch () const
 
bScore attenuateScore (bScore const sc) const
 converge score towards zero in order to force immediate best move first
 
void setLevel (bLevel *l)
 
bLevelgetLevel ()
 
void sendInfoCurrMove (bBoard const &b, 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 ()
 
long long getDurationSec () const
 
long long getDurationMilliSec () const
 

Detailed Description

Definition at line 79 of file search.h.

Constructor & Destructor Documentation

◆ bSearchAlgorithm() [1/3]

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

Definition at line 132 of file search.cpp.

◆ ~bSearchAlgorithm()

bSearchAlgorithm::~bSearchAlgorithm ( )
override

Definition at line 139 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 90 of file search.h.

◆ getNodes()

int64_t bSearchAlgorithm::getNodes ( ) const
inline

Definition at line 92 of file search.h.

Referenced by bGame::DoPerft().

+ Here is the caller graph for this function:

◆ getNonLeafNodes()

int64_t bSearchAlgorithm::getNonLeafNodes ( ) const
inline

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  m)

Definition at line 258 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 ( )

Definition at line 267 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 273 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
Todo:
Add debug manipulator
Todo:
retrieve best move id without sorting it on top

Definition at line 152 of file search.cpp.

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

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

◆ sendInfoSearching()

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

Definition at line 301 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 343 of file search.cpp.

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

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

◆ CalcBestMove()

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

Implemented in SearchAlphaBeta, SearchBruteForce, SearchPerft, SearchEvalPosOnly, 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 278 of file search.cpp.

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

+ Here is the call graph for this function:
+ 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 356 of file search.cpp.

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

+ Here is the caller graph for this function:

◆ setLevel()

void bSearchAlgorithm::setLevel ( bLevel l)
inlineprotected

Definition at line 116 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  nDepth,
movenum_t const  moveid 
) const
protected

Definition at line 327 of file search.cpp.

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

+ 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 316 of file search.cpp.

+ Here is the call graph for this function:

◆ dumpMoveList()

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

Definition at line 288 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

◆ m_nodes

◆ m_nonleafnodes

◆ m_iterativesearch

bool bSearchAlgorithm::m_iterativesearch = false