1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
pub type SortFn = fn( acc: ((usize, usize), i32), item: &((usize, usize), i32) ) -> ((usize, usize), i32); #[derive(Debug, PartialEq, Clone)] pub enum Turn { /// Player is looking to maximise the value of the heuristic Player, /// Adversary is looking to minimise the value of the heuristic Adversary } impl Turn { pub fn other(&self) -> Turn { match *self { Turn::Player => Turn::Adversary, Turn::Adversary => Turn::Player, } } pub fn sign_alternation(&self) -> i32 { match *self { Turn::Player => -1, Turn::Adversary => 1, } } }