pub trait OrderHooks<R: Sides> {
type Piece: Eq + Copy;
// Required methods
fn prepare(&mut self, rules: &R);
fn classify(&mut self, rules: &R, command: &R::Command) -> Kind<Self::Piece>;
fn pick(&mut self, rules: &R) -> Option<R::Command>;
fn at(&self, rules: &R, piece: Self::Piece) -> Option<Pos>;
fn distance(
&mut self,
rules: &R,
piece: Self::Piece,
from: Pos,
) -> Option<u32>;
fn safe(&self, rules: &R, at: Pos) -> bool;
}Expand description
What a TacticsOrder asks the game, once per
order call. The game’s hooks hold the state’s
Threats and GoalDistance,
built in prepare.
Required Associated Types§
Required Methods§
Sourcefn prepare(&mut self, rules: &R)
fn prepare(&mut self, rules: &R)
Called first: build this state’s Threats and
GoalDistance.
Sourcefn classify(&mut self, rules: &R, command: &R::Command) -> Kind<Self::Piece>
fn classify(&mut self, rules: &R, command: &R::Command) -> Kind<Self::Piece>
What command is, called once per legal command, in the legal
order.
Sourcefn pick(&mut self, rules: &R) -> Option<R::Command>
fn pick(&mut self, rules: &R) -> Option<R::Command>
The game’s own pick (an AI’s command), if it has one; it may also be a strike or a step, and is listed once.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".