#include <libbenbot/search/Context.hpp>
This struct encapsulates everything needed to perform a search. You can keep one of these alive between searches by simply updating the options and then calling search() again.
Definition at line 47 of file Context.hpp.
◆ Context() [1/4]
| ben_bot::search::Context::Context |
( |
| ) |
|
|
default |
Creates a search context with empty callbacks.
◆ Context() [2/4]
| ben_bot::search::Context::Context |
( |
Callbacks && | callbacksToUse | ) |
|
|
inlineexplicit |
Creates a search context with a specified set of result callbacks.
Definition at line 52 of file Context.hpp.
◆ Context() [3/4]
| ben_bot::search::Context::Context |
( |
const Context & | | ) |
|
|
delete |
◆ Context() [4/4]
| ben_bot::search::Context::Context |
( |
Context && | | ) |
|
|
delete |
◆ ~Context()
| ben_bot::search::Context::~Context |
( |
| ) |
|
|
default |
◆ abort()
| void ben_bot::search::Context::abort |
( |
| ) |
|
|
inlinenoexcept |
This function may be called while search() is executing to interrupt the search. If a search is in progress, calling this method will cause the search routine to return at the next available point. This method returns immediately; to wait for the search to complete, call wait() after calling this method.
Definition at line 81 of file Context.hpp.
◆ clear_history()
| void ben_bot::search::Context::clear_history |
( |
| ) |
|
|
inline |
Clears the killer moves & the history heuristic tables. This should be called at the start of each new game, along with clear_transposition_table(), so that what was learnt in one game doesn't affect the next one. If a search is in progress, this method aborts it and blocks until it returns.
Definition at line 107 of file Context.hpp.
◆ clear_transposition_table()
| void ben_bot::search::Context::clear_transposition_table |
( |
| ) |
|
|
inline |
Clears the transposition table & the pawn hash table. If a search is in progress, this method aborts it and blocks until it returns.
Definition at line 93 of file Context.hpp.
◆ get_continuation_history()
| auto ben_bot::search::Context::get_continuation_history |
( |
| ) |
const -> const ContinuationHistory & |
|
inlinenodiscardnoexcept |
Returns the continuation history table.
Definition at line 120 of file Context.hpp.
◆ get_history_table()
| auto ben_bot::search::Context::get_history_table |
( |
| ) |
const -> const HistoryTable & |
|
inlinenodiscardnoexcept |
Returns the history heuristic table.
Definition at line 117 of file Context.hpp.
◆ get_options()
| auto ben_bot::search::Context::get_options |
( |
| ) |
const -> const Options & |
|
inlinenodiscardnoexcept |
Returns the current search parameters.
Definition at line 205 of file Context.hpp.
◆ get_position()
| auto ben_bot::search::Context::get_position |
( |
| ) |
const -> const Position & |
|
inlinenodiscardnoexcept |
Returns the current position.
Definition at line 202 of file Context.hpp.
◆ in_progress()
| auto ben_bot::search::Context::in_progress |
( |
| ) |
const -> bool |
|
inlinenodiscardnoexcept |
Returns true if a search is currently in progress.
Definition at line 140 of file Context.hpp.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ ponder_hit()
| void ben_bot::search::Context::ponder_hit |
( |
| ) |
|
|
inlinenoexcept |
When in a ponder mode search, this exits the search. A ponder mode search will not exit until this method or abort() are called.
Definition at line 156 of file Context.hpp.
◆ probe_transposition_table()
| auto ben_bot::search::Context::probe_transposition_table |
( |
const Position & | pos | ) |
const -> std::optional< TTData > |
|
inlinenodiscard |
Probes the transposition table for the given position.
Definition at line 133 of file Context.hpp.
◆ reset_abort()
| void ben_bot::search::Context::reset_abort |
( |
| ) |
|
|
inlinenoexcept |
Clears any previous abort() request, so that the next call to search() will run. This must be called before starting each search; search() itself doesn't reset the flag, so that an abort() call made after a search has been requested but before it has actually begun still takes effect.
Definition at line 88 of file Context.hpp.
◆ resize_transposition_table()
| void ben_bot::search::Context::resize_transposition_table |
( |
const size_t | sizeMB | ) |
|
|
inline |
Resizes the transposition table. If a search is in progress, this method aborts it and blocks until it returns.
Definition at line 125 of file Context.hpp.
◆ search()
| void ben_bot::search::Context::search |
( |
| ) |
|
Performs a search. Results will be propagated via the callbacks that have been assigned.
The search may execute for a potentially unbounded amount of time. The search can be interrupted by calling the abort() method while search() is executing.
◆ set_callbacks()
| void ben_bot::search::Context::set_callbacks |
( |
Callbacks && | callbacksToUse | ) |
|
|
inline |
Sets the result callbacks that will be used for the next search. If a search is in progress, this function aborts it and blocks until it completes.
Definition at line 194 of file Context.hpp.
◆ set_options() [1/2]
Sets the options to be used by the next search. If a search is in progress, this function aborts it and blocks until it completes.
Definition at line 184 of file Context.hpp.
◆ set_options() [2/2]
| void ben_bot::search::Context::set_options |
( |
const Options & | opts | ) |
|
|
inline |
Sets the options to be used by the next search. If a search is in progress, this function aborts it and blocks until it completes.
Definition at line 174 of file Context.hpp.
◆ set_pondering()
| void ben_bot::search::Context::set_pondering |
( |
const bool | isPonderMode | ) |
|
|
inlinenoexcept |
Sets whether the next search will be in ponder mode. When in ponder mode, the search will not exit until abort() or ponder_hit() are called.
Definition at line 151 of file Context.hpp.
◆ set_position()
| void ben_bot::search::Context::set_position |
( |
const Position & | pos | ) |
|
|
inline |
Sets the position to be searched by the next search. If a search is in progress, this function aborts it and blocks until it completes.
Definition at line 161 of file Context.hpp.
◆ wait()
| void ben_bot::search::Context::wait |
( |
| ) |
const |
Blocks the calling thread until the search in progress is complete. Returns immediately if no search was in progress when this function was called.
The documentation for this struct was generated from the following file: