Belofte version 2.1.8
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
16
20
22{
23 m_maxDepth = 1;
24 bMoveList& ml = b.getMoveListRef();
25 movenum_t n_moves = ml.generateMoves(b);
26 for (movenum_t moveid = 1; moveid <= n_moves; moveid++) {
27 m_nodes++;
28 sendInfoCurrMove(b, 1, moveid);
29 ml.setScoreOfMove(moveid, static_cast<bScore>(belofte::getRandomInt(20)));
30 }
31 return SCORE_UNDEFINED;
32}
33
34//-----------------------------------------------------------------------
35
36// eof
This is the main include file, needs to be included before any other include.
uint_fast8_t movenum_t
Definition belofte.h:109
int16_t bScore
bScore CalcBestMove(bBoard &b) override
~SearchRandom() override
board
Definition board.h:147
bMoveList & getMoveListRef()
return reference to movelist
Definition board.cpp:954
movenum_t setScoreOfMove(movenum_t const moveid, bScore const score)
Store score of move.
Definition movelist.cpp:207
movenum_t generateMoves(bBoard const &b)
generate moves if not yet generated
Definition movelist.cpp:259
void sendInfoCurrMove(bBoard const &b, depth_t const nDepth, movenum_t const moveid) const
Definition search.cpp:327
depth_t m_maxDepth
Definition search.h:106
int64_t m_nodes
Definition search.h:107
constexpr bScore SCORE_UNDEFINED
Definition eval.h:20