Trait alcibiades::TimeManager [] [src]

pub trait TimeManager<T: DeepeningSearch<ReportData = Vec<Variation>>>: SetOption {
    fn new(position: &T::SearchNode, time: &RemainingTime) -> Self;
    fn must_play(
        &mut self,
        search_instance: &mut T,
        report: Option<&SearchReport<Vec<Variation>>>
    ) -> bool; }

A trait for deciding when the search must be terminated and the best move played.

To implement your own time management logic, you must define a type that implements the TimeManager trait.

Required Methods

Creates a new instance.

  • position gives the current position.

  • time gives the remaining time on the clocks.

Returns true if the search must be terminated and the best move played.

  • search_instance is a mutable reference to the currently running search instance. The time manager should be careful when calling methods on the currently running search instance, so as not to disturb its normal working. In particular, start_search and try_recv_report methods must not be called, and a "TERMINATE" message must not be sent.

  • report, when supplied, gives a reference to an incoming search progress report. must_play will be called exactly once for each progress report generated by the search, following the order in which the reports have been generated.

Implementors