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