io-chess
UCI chess engine
Loading...
Searching...
No Matches
ISearch Class Referenceabstract

Abstract interface for search algorithms. More...

#include <ISearch.h>

Inheritance diagram for ISearch:

Public Member Functions

virtual ~ISearch ()=default
virtual Move startSearch (Board &root, const SearchParams &params)=0
 Starts the search process on the given root board.
virtual void stop ()=0
 Asynchronously signals the search to stop immediately.
virtual bool isSearching () const =0
 Checks if the search algorithm is currently running.
virtual void setInfoCallback (InfoCallback callback)=0
 Sets the callback function for periodic information updates.
virtual uint64_t getNodes () const =0
 Retrieves the total number of nodes evaluated by the search algorithm.

Detailed Description

Abstract interface for search algorithms.

This interface defines the standard lifecycle of a search algorithm, allowing the engine to switch between implementations (e.g., Negamax vs. MCTS).

Constructor & Destructor Documentation

◆ ~ISearch()

virtual ISearch::~ISearch ( )
virtualdefault

Member Function Documentation

◆ getNodes()

virtual uint64_t ISearch::getNodes ( ) const
pure virtual

Retrieves the total number of nodes evaluated by the search algorithm.

Returns
The node count.

Implemented in MCTS, and Negamax.

◆ isSearching()

virtual bool ISearch::isSearching ( ) const
pure virtual

Checks if the search algorithm is currently running.

Returns
True if a search is in progress.

Implemented in MCTS, and Negamax.

◆ setInfoCallback()

virtual void ISearch::setInfoCallback ( InfoCallback callback)
pure virtual

Sets the callback function for periodic information updates.

Parameters
callbackThe function to call with depth, score, node count, NPS, and PV.

Implemented in MCTS, and Negamax.

◆ startSearch()

virtual Move ISearch::startSearch ( Board & root,
const SearchParams & params )
pure virtual

Starts the search process on the given root board.

This is a blocking call that will execute the search algorithm until the stopping conditions in params (or stop()) are met.

Parameters
rootThe starting board position.
paramsThe time and depth constraints for the search.
Returns
The best move found.

Implemented in MCTS, and Negamax.

◆ stop()

virtual void ISearch::stop ( )
pure virtual

Asynchronously signals the search to stop immediately.

This method must be thread-safe.

Implemented in MCTS, and Negamax.


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