![]() |
Cinnamon
1.1
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 : 00011 char { hashfEXACT = 1, hashfALPHA = 0, hashfBETA = 2 }; 00012 Hash(); 00013 virtual ~Hash(); 00014 void setHashSize(int mb); 00015 int getHashSize(); 00016 void clearHash(); 00017 00018 protected: 00019 00020 #pragma pack(push) 00021 #pragma pack(1) 00022 typedef struct { 00023 u64 key; 00024 short score; 00025 uchar flags:2; 00026 char depth; 00027 uchar from :6; 00028 uchar to :6; 00029 uchar entryAge :1; 00030 } _Thash; 00031 #pragma pack(pop) 00032 00033 int HASH_SIZE; 00034 _Thash * hash_array_greater[2]; 00035 _Thash * hash_array_always[2]; 00036 void recordHash(bool running, _Thash* phashe_greater,_Thash* phashe_always,const char depth, const char flags, const u64 key, const int score, _Tmove* bestMove); 00037 void clearAge(); 00038 #ifdef DEBUG_MODE 00039 unsigned nRecordHashA,nRecordHashB,nRecordHashE, collisions; 00040 unsigned n_cut_hash; 00041 int n_cut_hashA, n_cut_hashE, n_cut_hashB, cutFailed, probeHash; 00042 #endif 00043 00044 private: 00045 void dispose(); 00046 }; 00047 00048 #endif 00049