![]() |
Cinnamon
1.0
chess engine
|
00001 #ifndef SEARCH_H_ 00002 #define SEARCH_H_ 00003 #include <sys/timeb.h> 00004 #include "Eval.h" 00005 #include "namespaces.h" 00006 00007 class Search: public Eval ,public Hash { 00008 00009 public: 00010 00011 Search(); 00012 virtual ~Search(); 00013 void setRunning(int); 00014 void setPonder(bool) ; 00015 void pushMovesPath(char); 00016 void clearMovesPath(); 00017 void setNullMove(bool) ; 00018 void setMaxTimeMillsec(int); 00019 int getMaxTimeMillsec(); 00020 void startClock(); 00021 int getRunning(); 00022 00023 protected: 00024 00025 typedef struct { 00026 int cmove; 00027 _Tmove argmove[GenMoves::MAX_PLY]; 00028 } _TpvLine; 00029 00030 string getMovesPath(); 00031 void setMainPly(int); 00032 int search(int depth, int alpha, int beta, _TpvLine * pline); 00033 #ifdef DEBUG_MODE 00034 unsigned cumulativeMovesCount,totGen; 00035 #endif 00036 private: 00037 00038 void setMaxDepthSearch(int); 00039 int getMaxDepthSearch(); 00040 bool checkDraw(u64 key); 00041 bool ponder; 00042 int checkTime(); 00043 string movesPath; 00044 int running, mainDepth, maxTimeMillsec; 00045 bool nullSearch; 00046 struct timeb startTime; 00047 template <int side> int search(u64 key, int depth, int alpha, int beta, _TpvLine * pline/*,int*/); 00048 void sortHashMoves(int listId, _Thash*); 00049 template <int side> int quiescence(u64 key, int alpha, int beta, const char promotionPiece, int dep); 00050 void updatePv(_TpvLine * pline, const _TpvLine * line, const _Tmove * move); 00051 template <int side> void updatePv(_TpvLine * pline, const _TpvLine * line, const int from, const int to); 00052 }; 00053 #endif