BenBot 1.7.5
A chess engine
Loading...
Searching...
No Matches
ben_bot::search::Callbacks Struct Referencefinal

#include <libbenbot/search/Callbacks.hpp>

Public Types

using Callback = std::function<void(const Result&)>

Public Member Functions

void iteration_complete (const Result &result) const
void root_move (const Move move, const size_t idx) const
void search_complete (const Result &result) const
void search_start (const Options &options) const

Static Public Member Functions

static auto make_pretty_printer (std::function< std::string(Move)> &&printMove) -> Callbacks
static auto make_uci_printer (std::function< bool()> isDebugMode) -> Callbacks

Public Attributes

Callback onIteration
std::function< void(Move, size_t)> onRootMove
Callback onSearchComplete
std::function< void(const Options &)> onSearchStart

Detailed Description

This struct encapsulates a set of functions that will be called to process search progress and results. Search results are always retrieved through these callbacks.

See also
Context

Definition at line 40 of file Callbacks.hpp.

Member Typedef Documentation

◆ Callback

using ben_bot::search::Callbacks::Callback = std::function<void(const Result&)>

Function type that accepts a single Result argument.

Definition at line 42 of file Callbacks.hpp.

Member Function Documentation

◆ iteration_complete()

void ben_bot::search::Callbacks::iteration_complete ( const Result & result) const
inline

Can be safely called without checking if onIteration is null.

Definition at line 78 of file Callbacks.hpp.

◆ make_pretty_printer()

auto ben_bot::search::Callbacks::make_pretty_printer ( std::function< std::string(Move)> && printMove) -> Callbacks
staticnodiscard

Creates a set of callbacks that print search information in a human-readable table-aligned format.

Parameters
printMoveFunction object that will be used to format Move objects to display the PV.
Note
The output produced by these callbacks does not conform to the UCI protocol!

◆ make_uci_printer()

auto ben_bot::search::Callbacks::make_uci_printer ( std::function< bool()> isDebugMode) -> Callbacks
staticnodiscard

Creates a set of callbacks that print UCI-formatted information and bestmove output to standard output.

Parameters
isDebugModeFunction object that should return true if debug information should be included in the information output.

◆ root_move()

void ben_bot::search::Callbacks::root_move ( const Move move,
const size_t idx ) const
inline

Can be safely called without checking if onRootMove is null.

Definition at line 87 of file Callbacks.hpp.

◆ search_complete()

void ben_bot::search::Callbacks::search_complete ( const Result & result) const
inline

Can be safely called without checking if onSearchComplete is null.

Definition at line 69 of file Callbacks.hpp.

◆ search_start()

void ben_bot::search::Callbacks::search_start ( const Options & options) const
inline

Can be safely called without checking if onSearchStart is null.

Definition at line 62 of file Callbacks.hpp.

Member Data Documentation

◆ onIteration

Callback ben_bot::search::Callbacks::onIteration

Function object that will be invoked with results from each iteration of the iterative deepening loop.

Definition at line 53 of file Callbacks.hpp.

◆ onRootMove

std::function<void(Move, size_t)> ben_bot::search::Callbacks::onRootMove

Function object that will be invoked with each root move being searched. The second argument is the index of the current move in the list of moves being searched.

Definition at line 59 of file Callbacks.hpp.

◆ onSearchComplete

Callback ben_bot::search::Callbacks::onSearchComplete

Function object that will be invoked with results from a completed search.

Definition at line 48 of file Callbacks.hpp.

◆ onSearchStart

std::function<void(const Options&)> ben_bot::search::Callbacks::onSearchStart

Function object that will be invoked when a new search is started.

Definition at line 45 of file Callbacks.hpp.


The documentation for this struct was generated from the following file: