24 ss <<
"Searching started: " << this->
operator std::string() <<
" "
25 <<
getLevel()->operator std::string()
27 m_appei->sendInfoSearchStart(ss.str());
40 m_appei->sendInfo(
"engine should not have started searching as position is final");
41 m_appei->sendResult(b, gr);
48 SearchBestMoveIterative(b, ml);
68 int8_t nFluctuations = 0;
74 std::string sPreviousBestMove, sNewBestMove;
76 while (iCurrentDepth <=
getLevel()->getMaxDepth()) {
80 m_appei->
sendDebug(1,
"Iterative Depth Search " + sDepth);
91 if (nDuration < 1) nDuration = 1;
92 long nNPS = nNodes * 1000000 / nDuration;
93 m_appei->
sendInfoDepth(iCurrentDepth, m_maxDepth, nNodes,
static_cast<int>(nNPS));
98 }
catch (
const searchAbortedException&) {
101 }
catch (...) {
throw;
122 if (!sPreviousBestMove.empty()
123 && (sNewBestMove != sPreviousBestMove)
124 && iCurrentDepth > 3) {
137 }
else if (sPreviousBestMove.empty() && !sNewBestMove.empty()) {
139 sPreviousBestMove = sNewBestMove;
140 }
else if (sNewBestMove != sPreviousBestMove) {
142 sPreviousBestMove = sNewBestMove;
147 if (iCurrentDepth <
getLevel()->getMaxDepth()) {
148 dumpMoveList(b, iCurrentDepth);
178void bSearchAlgorithm::dumpMoveList(
bBoard const& b,
depth_t const iDepth)
const
183 std::stringstream ss;
192 depth_t const nDepth, std::string
const& comment)
const
194 if (nDepth <= m_postlevel) {
196 m_appei->sendInfoSearching(b, nDepth, m_maxDepth, comment,
SCORE_UNDEFINED,
206 depth_t const nDepth, std::string
const& comment,
209 if (nDepth <= m_postlevel) {
211 m_appei->sendInfoSearching(b, nDepth, m_maxDepth,
215 m_appei->sendInfoSearching(b, nDepth, m_maxDepth,
228 if (nCurDepth < m_postlevel) {
229 m_appei->sendInfoCurrMove(b, nCurDepth,
251 return m_evalptr->getEvaluation(b) * b.
minimizing();
engineInterface * AppEI()
This is the main include file, needs to be included before any other include.
std::string getDuration() const
long long getDurationMilliSec() const
long long getDurationMicroSec() const
outputWriter sout
normal output
constexpr bool whiteToMove() const
constexpr bScore minimizing() const
void calcMinorPieces(bool const bForceRecalc=false)
Recalculate minor pieces, used for evaluation and end of game condition in case of less than 5 pieces...
movesequence_t const & getVariation() const
void calcGameStage()
calculate stage of game to assist in evaluation
void setPreviousMoves(movesequence_t const &v)
bPositionEvaluation * getEval() const
void setMoreTimeRequired()
increase gradually the allowed time for move, first move to max time for move, then move to abort tim...
void setSearchDepth(depth_t const d)
movenum_t generateMoves(bBasicBoard const &b)
generate moves if not yet generated
void sortMoves()
sort moves and update bestmove id if less than 5 moves, sort all if more than 5 moves,...
bool atLeastOneMovePossible(bBasicBoard &b)
see if at least one move can be played e.g.
static bScore resultToScoreFlag(gameResult_t const gr)
Class static function convert all draw scores to SCORE_THEORETIC_DRAW.
static gameResult_t gameEndedResult(bBoard const &b)
Class static function See if board is in finite state, meaning game is ended.
void StartSearch(bScore const sc)
void sendInfoCurrMove(bBoard const &b, depth_t const nCurDepth, bMove const &m, movenum_t const moveid) const
void initMaxSearchedDepth()
constexpr bool isNoBench() const
void SearchBestMove(bBoard &b, bMoveList &ml)
Generic search, will call (non-)recursive method per algorithm only when there are moves to be played...
bScore RetrieveBoardEvaluation(bBoard &b, gameResult_t const gr=GR_UNSET) const
Get score of board, eventually from cache.
void CheckIfAbortingSearch() const
void sendInfoSearching(bBoard const &b, depth_t const nDepth, std::string const &comment) const
virtual bScore CalcBestMove(bBoard &b, bMoveList &ml)=0
constexpr bScore realScore() const
static constexpr bool isUndefinedScore(bScore const score)
virtual void sendDebug(int const l, std::string const &info)
virtual void sendInfoDepth(int depth, int seldepth, int64_t nodes, int nps)
enum gameResult gameResult_t
constexpr bScore SCORE_WINNING
constexpr bScore SCORE_UNDEFINED
std::string to_string(int16_t value)
std::to_string not compatible on Mac OS (Apple LLVM version 5.0) provide generic utility function