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
fn new(position: &T::SearchNode, time: &RemainingTime) -> Self
Creates a new instance.
position
gives the current position.time
gives the remaining time on the clocks.
fn must_play(
&mut self,
search_instance: &mut T,
report: Option<&SearchReport<Vec<Variation>>>
) -> bool
&mut self,
search_instance: &mut T,
report: Option<&SearchReport<Vec<Variation>>>
) -> bool
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
andtry_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
impl<T> TimeManager<T> for StdTimeManager where
T: DeepeningSearch<ReportData = Vec<Variation>>,