]> git.sesse.net Git - stockfish/blob - src/search.h
Convert book.cpp to use C++ I/O
[stockfish] / src / search.h
1 /*
2   Glaurung, a UCI chess playing engine.
3   Copyright (C) 2004-2008 Tord Romstad
4
5   Glaurung is free software: you can redistribute it and/or modify
6   it under the terms of the GNU General Public License as published by
7   the Free Software Foundation, either version 3 of the License, or
8   (at your option) any later version.
9   
10   Glaurung is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   GNU General Public License for more details.
14   
15   You should have received a copy of the GNU General Public License
16   along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 */
18
19
20 #if !defined(SEARCH_H_INCLUDED)
21 #define SEARCH_H_INCLUDED
22
23 ////
24 //// Includes
25 ////
26
27 #include "types.h"
28 #include "depth.h"
29 #include "history.h"
30 #include "lock.h"
31 #include "movegen.h"
32 #include "position.h"
33 #include "tt.h"
34 #include "value.h"
35
36
37 ////
38 //// Constants
39 ////
40
41 const int PLY_MAX = 100;
42 const int PLY_MAX_PLUS_2 = 102;
43
44
45 ////
46 //// Types
47 ////
48
49 /// The SearchStack struct keeps track of the information we need to remember
50 /// from nodes shallower and deeper in the tree during the search.  Each
51 /// search thread has its own array of SearchStack objects, indexed by the
52 /// current ply.
53
54 struct SearchStack {
55   Move pv[PLY_MAX];
56   Move currentMove;
57   Value currentMoveCaptureValue;
58   Move mateKiller, killer1, killer2;
59   Move threatMove;
60   Depth reduction;
61 };
62
63
64 ////
65 //// Global variables
66 ////
67
68 extern TranspositionTable TT;
69
70 extern int ActiveThreads;
71
72 extern Lock SMPLock;
73
74 // Perhaps better to make H local, and pass as parameter to MovePicker?
75 extern History H;  
76
77
78 ////
79 //// Prototypes
80 ////
81
82 extern void init_threads();
83 extern void stop_threads();
84 extern void think(const Position &pos, bool infinite, bool ponder, int side_to_move,
85                   int time[], int increment[], int movesToGo, int maxDepth, 
86                   int maxNodes, int maxTime, Move searchMoves[]);
87 extern int64_t nodes_searched();
88
89
90 #endif // !defined(SEARCH_H_INCLUDED)