TranspositionTable

Struct TranspositionTable 

Source
pub struct TranspositionTable { /* private fields */ }
Expand description

Structure for representing a TranspositionTable. A Transposition Table is a type of HashTable that maps Zobrist Keys to information about that position, including the best move found, score, depth the move was found at, and other information.

Implementations§

Source§

impl TranspositionTable

Source

pub const MAX_SIZE_MB: usize = 100_000usize

Source

pub fn new(mb_size: usize) -> Self

Creates new with a size of around ‘mb_size’. Actual size is the nearest power of 2 times the size of a Cluster rounded down.

§Panics

mb_size should be > 0, or else a panic will occur

Source

pub fn new_num_entries(num_entries: usize) -> Self

Creates new TT rounded up to the nearest power of two number of entries.

§Panics

num_entries should be > 0, or else a panic will occur

Source

pub fn new_num_clusters(num_clusters: usize) -> Self

Creates new TT rounded up to the nearest power of two number of Clusters.

§Panics

Size should be > 0, or else a panic will occur

Source

pub unsafe fn uninitialized_init(&self, mb_size: usize)

Source

pub fn size_kilobytes(&self) -> usize

Returns the size of the heap allocated portion of the TT in KiloBytes.

Source

pub fn size_megabytes(&self) -> usize

Returns the size of the heap allocated portion of the TT in MegaBytes.

Source

pub fn size_gigabytes(&self) -> usize

Returns the size of the heap allocated portion of the TT in GigaBytes.

Source

pub fn num_clusters(&self) -> usize

Returns the number of clusters the Transposition Table holds.

Source

pub fn num_entries(&self) -> usize

Returns the number of Entries the Transposition Table holds.

Source

pub unsafe fn resize_round_up(&self, size: usize)

Re-sizes to ‘size’ number of Clusters and deletes all data

§Panic

size must be greater then 0

§Safety

This is function is unsafe to use if the TT is currently being accessed, Or any thread of structure contains a current reference to a TTEntry. Otherwise, using this function will absolutely lead to a Segmentation Fault.

Source

pub unsafe fn resize_to_megabytes(&self, mb_size: usize) -> usize

Re-sizes to the the mb_size number of megabytes, rounded down for power of 2 number of clusters. Returns the actual size.

§Panic

mb_size must be greater then 0

§Safety

This is function is unsafe to use if the TT is currently being accessed, Or any thread of structure contains a current reference to a TTEntry. Otherwise, using this function will absolutely lead to Segmentation Fault.

Source

pub unsafe fn clear(&self)

Clears the entire TranspositionTable

§Safety

This is function is unsafe to use if the TT is currently being accessed, Or any thread of structure contains a current reference to a TTEntry. Otherwise, using this function will absolutely lead to a Segmentation Fault.

Source

pub fn time_age(&self) -> u8

Returns the current time age of a TT.

Source

pub fn time_age_cylces(&self) -> u8

Returns the current number of cycles a TT has gone through. Cycles is simply the number of times refresh has been called.

Source

pub fn probe(&self, key: Key) -> (bool, &mut Entry)

Probes the Transposition Table for a specified Key. Returns (true, entry) if either (1) an Entry corresponding to the current key is found, or an Open Entry slot is found for the key. In the case of an open Entry, the entry can be tested for its contents by using Entry::is_empty(). If no entry is found && there are no open entries, returns the entry that is is most irrelevent to the current search, e.g. has the shallowest depth or was found in a previous search.

If ‘true’ is returned, the Entry is guaranteed to have the correct time.

Source

pub fn hash_percent(&self) -> f64

Returns the % of the hash table that is full.

Trait Implementations§

Source§

impl Drop for TranspositionTable

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl PreFetchable for TranspositionTable

Source§

fn prefetch(&self, key: u64)

Pre-fetches a particular key. This means bringing it into the cache for faster eventual access.

Source§

fn prefetch2(&self, key: u64)

Pre-fetches a particular key, alongside the next key.
Source§

impl Sync for TranspositionTable

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> 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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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