![]() |
Cinnamon
1.1
chess engine
|
00001 #ifndef PERFT_H_ 00002 #define PERFT_H_ 00003 00004 #include "Search.h" 00005 #include "Thread.h" 00006 #include <iomanip> 00007 #include <atomic> 00008 00009 class Perft { 00010 00011 public: 00012 Perft(string fen, int depth, int nCpu, int HASH_SIZE); 00013 ~Perft(); 00014 00015 private: 00016 00017 #pragma pack(push) 00018 #pragma pack(1) 00019 typedef struct { 00020 u64 key; 00021 u64* nMovesXply; 00022 } _ThashPerft; 00023 #pragma pack(pop) 00024 00025 int nCollisions,PERFT_HASH_SIZE, mainDepth, nCpu; 00026 static const u64 NULL_KEY = 0xffffffffffffffffULL; 00027 _ThashPerft * hash; 00028 atomic_ullong totMoves; 00029 00030 void setResult(u64 result) { 00031 totMoves += result; 00032 } 00033 00034 class PerftThread: public Thread, public GenMoves { 00035 public: 00036 PerftThread(int, string fen, int from, int to, Perft* Perft); 00037 PerftThread(); 00038 virtual ~PerftThread(); 00039 00040 private: 00041 virtual void run(); 00042 template <int side> u64 search(int depth); 00043 int from, to,cpuID; 00044 Perft* perft; 00045 }; 00046 vector<PerftThread*> threadList; 00047 }; 00048 #endif 00049