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.
21 /* killer heuristics */
29 uint64_t delta_prunings
;
31 uint64_t failed_high_first
;
32 uint64_t failed_high_total
;
33 uint64_t futility_prunings
;
34 uint64_t null_move_prunings
;
36 uint64_t pawn_hash_evaluations
;
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
];
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 */
61 int side
; /* what engine's side */
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 */
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
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
[]);
107 void print_stats(int timediff
);
108 void start_engine(void);
109 void perform_cleanup(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
);