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 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(chess::moves::Move)> &&printMove) -> Callbacks
static auto make_uci_printer (std::function< bool()> &&isDebugMode) -> Callbacks

Public Attributes

Callback onIteration
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 41 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 43 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 73 of file Callbacks.hpp.

◆ make_pretty_printer()

auto ben_bot::search::Callbacks::make_pretty_printer ( std::function< std::string(chess::moves::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.

◆ 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 64 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 57 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 54 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 49 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 46 of file Callbacks.hpp.


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