Fix in candidate passer calculation
[owl.git] / engine.h
blobf71c60561436e701f2ec3d57deb4794aabd1d511
1 /*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 #ifndef NOLMR_MOVES
18 #define NOLMR_MOVES 3
19 #endif
21 /* killer heuristics */
22 struct killers_t {
23 int killer1;
24 int killer2;
25 int mate_killer;
28 struct counters_t {
29 uint64_t delta_prunings;
30 uint64_t evaluations;
31 uint64_t failed_high_first;
32 uint64_t failed_high_total;
33 uint64_t futility_prunings;
34 uint64_t null_move_prunings;
35 uint64_t misc;
36 uint64_t pawn_hash_evaluations;
37 uint64_t razorings;
38 uint64_t reductions;
39 uint64_t searched_nodes;
40 uint64_t transposition;
43 extern int history[2][7][4096]; /* cut off history */
44 extern int hash_moves[MAX_PLY]; /* moves from transposition
45 table (searched first) */
46 extern struct killers_t killers[MAX_PLY];
47 extern struct counters_t counters;
49 extern int pv[MAX_PLY][MAX_PLY];
50 extern int pv_length[MAX_PLY];
52 struct epd_info_t {
53 char *filename; /* filename of .epd file. we should free this pointer
54 after completing tests */
55 int think_time; /* time in seconds for each position */
56 int max_tests; /* max number of tests to do */
57 int first_test; /* start from */
60 struct engine_t {
61 int side; /* what engine's side */
62 int phase_factor;
64 int force_mode;
65 int post_mode;
66 int xboard_mode;
67 int san_notation; /* output thinking using SAN notation */
69 int max_depth; /* max search depth */
70 int max_time; /* max search time */
72 int chk_time; /* check for exit every chk_time nodes */
73 int time_div; /* assume all time for time_div moves */
74 int fixed_time; /* don't stop search before max_time elapsed */
75 uint32_t stop_time;
76 int thinking; /* engine is thinking now */
77 pthread_t tid; /* thread id */
79 int pawn_hash_size; /* size of pawn hash table */
80 int main_hash_size; /* size of main hash table */
81 int pawn_hash_enabled; /* use pawn hashtable */
82 int main_hash_enabled; /* use main hashtable */
84 int resign; /* if TRUE engine resigs in bad positions */
85 int resign_value; /* resign if score is worse than this value */
86 int hopeless_moves; /* moves that made after score worse than
87 resign_value */
89 int delta_pruning;
90 int futility_pruning;
91 int iid;
92 int null_pruning;
93 int lmr;
94 int razoring;
96 pthread_mutex_t mutex;
99 extern struct engine_t e;
101 /* polyglot opening book functions */
102 void book_close(void);
103 void book_open(const char file_name[]);
104 int book_move(void);
106 void new_game(void);
107 void print_stats(int timediff);
108 void start_engine(void);
109 void perform_cleanup(void);
111 void loopcmd(void);
112 int check_time(int ply);
113 uint32_t get_time(void);
114 int get_engine_value(int *val);
115 void set_engine_value(int *src, int new_value);
117 /* these functions run in separate threads */
118 void *process_turn(void *args);
119 void *run_epd_test(void *args);