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
impl TranspositionTable
pub const MAX_SIZE_MB: usize = 100_000usize
Sourcepub fn new(mb_size: usize) -> Self
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
Sourcepub fn new_num_entries(num_entries: usize) -> Self
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
Sourcepub fn new_num_clusters(num_clusters: usize) -> Self
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
pub unsafe fn uninitialized_init(&self, mb_size: usize)
Sourcepub fn size_kilobytes(&self) -> usize
pub fn size_kilobytes(&self) -> usize
Returns the size of the heap allocated portion of the TT in KiloBytes.
Sourcepub fn size_megabytes(&self) -> usize
pub fn size_megabytes(&self) -> usize
Returns the size of the heap allocated portion of the TT in MegaBytes.
Sourcepub fn size_gigabytes(&self) -> usize
pub fn size_gigabytes(&self) -> usize
Returns the size of the heap allocated portion of the TT in GigaBytes.
Sourcepub fn num_clusters(&self) -> usize
pub fn num_clusters(&self) -> usize
Returns the number of clusters the Transposition Table holds.
Sourcepub fn num_entries(&self) -> usize
pub fn num_entries(&self) -> usize
Returns the number of Entries the Transposition Table holds.
Sourcepub unsafe fn resize_round_up(&self, size: usize)
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.
Sourcepub unsafe fn resize_to_megabytes(&self, mb_size: usize) -> usize
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.
Sourcepub unsafe fn clear(&self)
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.
pub fn new_search(&self)
Sourcepub fn time_age_cylces(&self) -> u8
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.
Sourcepub fn probe(&self, key: Key) -> (bool, &mut Entry)
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.
Sourcepub fn hash_percent(&self) -> f64
pub fn hash_percent(&self) -> f64
Returns the % of the hash table that is full.
Trait Implementations§
Source§impl Drop for TranspositionTable
impl Drop for TranspositionTable
Source§impl PreFetchable for TranspositionTable
impl PreFetchable for TranspositionTable
impl Sync for TranspositionTable
Auto Trait Implementations§
impl !Freeze for TranspositionTable
impl !RefUnwindSafe for TranspositionTable
impl !Send for TranspositionTable
impl Unpin for TranspositionTable
impl UnwindSafe for TranspositionTable
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
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>
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>
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