pub struct SolverHeuristic;Expand description
Minimax Heuristic that only looks at board outcomes. When there are multiple winning moves it picks the shortest one, and when there are only losing moves it picks the longest one.
Trait Implementations§
Source§impl Debug for SolverHeuristic
impl Debug for SolverHeuristic
Source§impl<B: Board> Heuristic<B> for SolverHeuristic
impl<B: Board> Heuristic<B> for SolverHeuristic
Source§type V = SolverValue
type V = SolverValue
The type used to represent the heuristic value of a board.
Source§fn value(&self, board: &B, length: u32) -> SolverValue
fn value(&self, board: &B, length: u32) -> SolverValue
Return the heuristic value for the given board from the the next player POV.
depth is the current depth, the number of moves played since the board the search was started on.
Can be used to prefer faster wins or slower losses.Source§fn merge(old: SolverValue, new: SolverValue) -> (SolverValue, Ordering)
fn merge(old: SolverValue, new: SolverValue) -> (SolverValue, Ordering)
Merge old and new into a new value, and compare their values.
For standard minimax searches this can simply be implemented as:
(max(old, new), new.cmp(old))Auto Trait Implementations§
impl Freeze for SolverHeuristic
impl RefUnwindSafe for SolverHeuristic
impl Send for SolverHeuristic
impl Sync for SolverHeuristic
impl Unpin for SolverHeuristic
impl UnwindSafe for SolverHeuristic
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more