![]() |
Cinnamon
1.0
chess engine
|
00001 #ifndef HASH_H_ 00002 #define HASH_H_ 00003 #include <iostream> 00004 #include <string.h> 00005 #include "namespaces.h" 00006 using namespace _board; 00007 00008 class Hash { 00009 public: 00010 enum { hashfEXACT=0, hashfALPHA=1, hashfBETA=2 }; 00011 Hash(); 00012 virtual ~Hash(); 00013 void setHashSize(int mb); 00014 int getHashSize(); 00015 void clearHash(); 00016 00017 protected: 00018 00019 #pragma pack(push) 00020 #pragma pack(1) 00021 typedef struct { 00022 u64 key; 00023 short score; 00024 uchar flags:2; 00025 uchar depth:6; 00026 uchar from :6; 00027 uchar to :6; 00028 uchar entryAge :1; 00029 } _Thash; 00030 #pragma pack(pop) 00031 00032 int HASH_SIZE; 00033 _Thash * hash_array_greater[2]; 00034 _Thash * hash_array_always[2]; 00035 void recordHash(bool running, _Thash* phashe_greater,_Thash* phashe_always,const char depth, const char flags, const u64 key, const int score, _Tmove* bestMove); 00036 void clearAge(); 00037 #ifdef DEBUG_MODE 00038 unsigned nRecordHashA,nRecordHashB,nRecordHashE, collisions; 00039 unsigned n_cut_hash; 00040 int n_cut_hashA, n_cut_hashE, n_cut_hashB, cutFailed, probeHash; 00041 #endif 00042 00043 private: 00044 void dispose(); 00045 }; 00046 00047 #endif