Belofte version 2.1.9
A promising chess program using the UCI or Winboard interface
search_random.cpp
Go to the documentation of this file.
1/*---------------------------------------------------------------------+
2 * File: search_random.cpp
3 * Project: part of belofte - A Promising Chess Program
4 * Author: yves
5 * SPDX-License-Identifier: GPL-2.0-only
6+----------------------------------------------------------------------*/
7
8#include "belofte.h"
9
10//-----------------------------------------------------------------------
11
12/**
13 * Root search for algorithm
14 * @param b board
15 * @param ml movelist of this position
16 */
18{
19 depth_t nDepth = 1;
21 ml.emptyMoveList();
22 ml.clearNeedSorted();
23 ml.clearKeepScores();
24 movenum_t n_moves = ml.generateMoves(b);
25 ml.clearScores();
26 for (movenum_t moveid = 1; moveid <= n_moves; ++moveid) {
28 bMove m(ml[moveid]);
29 sendInfoCurrMove(b, nDepth, m, moveid);
30 ml.setScoreOfMoveUnsorted(moveid, static_cast<bScore>(belofte::getRandomInt(20)));
31 }
32 return SCORE_UNDEFINED;
33}
34
35//-----------------------------------------------------------------------
36
37// eof
This is the main include file, needs to be included before any other include.
uint_fast8_t movenum_t
Definition belofte.h:100
int_fast8_t depth_t
Definition belofte.h:103
bScore CalcBestMove(bBoard &b, bMoveList &ml) override
Root search for algorithm.
board
Definition board.h:45
Definition move.h:13
void emptyMoveList()
Definition movelist.cpp:370
void clearScores()
Definition movelist.h:52
void clearNeedSorted()
Definition movelist.h:75
movenum_t generateMoves(bBasicBoard const &b)
generate moves if not yet generated
Definition movelist.cpp:340
void setScoreOfMoveUnsorted(movenum_t const moveid, bScore const score)
Store score of move and update best move.
Definition movelist.cpp:156
void clearKeepScores()
Definition movelist.h:79
void adjustMaxSearchedDepth(depth_t const nDepth)
Definition search.h:132
void sendInfoCurrMove(bBoard const &b, depth_t const nCurDepth, bMove const &m, movenum_t const moveid) const
Definition search.cpp:223
int64_t m_leafnodes
Definition search.h:124
int16_t bScore
Definition eval.h:11
constexpr bScore SCORE_UNDEFINED
Definition eval.h:21
int getRandomInt(int const nCeil)
return random in between 0 and nCeil - 1
Definition util.cpp:214