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