Struct SearchResult

Source
pub struct SearchResult {
Show 15 fields pub best_move: Move, pub score: Cp, pub pv: Line, pub player: Color, pub depth: PlyKind, pub nodes: u64, pub q_nodes: u64, pub elapsed: Duration, pub q_elapsed: Duration, pub stopped: bool, pub cut_nodes: u64, pub pv_nodes: u64, pub all_nodes: u64, pub tt_hits: u64, pub tt_cuts: u64,
}
Expand description

The results found from running a search on some root position.

Fields§

§best_move: Move

The best move to make for a position discovered from search.

§score: Cp

The centipawn score of making the best move, with absolute Cp (+White, -Black).

§pv: Line

The principal variation, or a sequence of the best moves that result in an evaluation of at least score Cp.

§player: Color

The player to move for the root position that was searched.

§depth: PlyKind

Depth (aka ply, half move) that was searched to. This depth is only fully searched if the stopped flag is false.

§nodes: u64

Total number of nodes visited in a search, including main search nodes and quiescence nodes.

§q_nodes: u64

Total number of nodes visited in a quiescence search.

§elapsed: Duration

Total time elapsed from the start to the end of a search.

§q_elapsed: Duration

Total time elapsed spent in quiescence search, within main search.

§stopped: bool

Flag that indicates this search was aborted.

§cut_nodes: u64

Number of nodes where a beta-cutoff was performed.

§pv_nodes: u64

Number of nodes that improved local alpha value without reaching beta.

§all_nodes: u64

Number of nodes that did not improve alpha or result in a cutoff.

§tt_hits: u64

Number of times a position was found in the transposition table.

§tt_cuts: u64

Number of times a tt hit score could be used and returned immediately.

Implementations§

Source§

impl SearchResult

Source

pub fn add_metrics(&mut self, other: Self)

Add the following metrics from other to this Result: nodes, q_nodes, elapsed, q_elapsed, beta_cutoffs, alpha_increases, tt_hits, tt_cuts.

Source

pub fn nps(&self) -> f64

Get average nodes per second of search.

Source

pub fn q_nps(&self) -> f64

Get average nodes per second of search for only quiescence search.

Source

pub fn quiescence_ratio(&self) -> f64

Returns the percentage of elapsed time of search that was in quiescence.

Example: elapsed=2.0s, q_elapsed=0.5s, quiescence_ratio=0.25

Source

pub fn tt_cut_ratio(&self) -> f64

Returns the percentage of tt hits that result in tt cuts.

Source

pub fn relative_score(&self) -> Cp

Converts the score of the search into one that is relative to search’s root player.

Source

pub fn absolute_score(&self) -> Cp

Converts the score of the search into one that is absolute, with White as + and Black as -.

Source

pub fn leading(&self) -> Option<Color>

Returns the color who is leading in the search of the root position, or None if drawn.

Trait Implementations§

Source§

impl Clone for SearchResult

Source§

fn clone(&self) -> SearchResult

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SearchResult

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SearchResult

Note that this default is technically illegal and does not represent any actual search.

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for SearchResult

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V