|
@@ -0,0 +1,44 @@
|
|
|
+use game::Game;
|
|
|
+use evaluate::PosValue;
|
|
|
+use std::collections::{HashMap};
|
|
|
+use std::hash::{BuildHasher, Hasher};
|
|
|
+
|
|
|
+pub enum EntryType {
|
|
|
+ Value,
|
|
|
+ LowerBound,
|
|
|
+ UpperBound,
|
|
|
+}
|
|
|
+
|
|
|
+pub struct CacheEntry {
|
|
|
+ entry_type: EntryType,
|
|
|
+ depth: i32,
|
|
|
+ value: PosValue
|
|
|
+}
|
|
|
+
|
|
|
+pub struct Cache {
|
|
|
+ hashmap: HashMap<Game, CacheEntry>,
|
|
|
+}
|
|
|
+
|
|
|
+pub struct GameHasher {
|
|
|
+}
|
|
|
+
|
|
|
+impl Hasher for GameHasher {
|
|
|
+ type Hasher = Self;
|
|
|
+
|
|
|
+ fn build_hasher(&self) -> Self::Hasher {
|
|
|
+ GameHasher {}
|
|
|
+ }
|
|
|
+
|
|
|
+ fn hash_one(&self, x: &Game) -> u64 {
|
|
|
+ 0
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+impl Cache {
|
|
|
+ pub fn new() -> Self {
|
|
|
+ Cache {
|
|
|
+ hashmap: HashMap::with_hasher(hash_builder: S)
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|