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 play_computer
; /* playing with a computer engine */
68 int san_notation
; /* output thinking using SAN notation */
70 int max_depth
; /* max search depth */
71 int max_time
; /* max search time */
73 int chk_time
; /* check for exit every chk_time nodes */
74 int time_div
; /* assume all time for time_div moves */
75 int fixed_time
; /* don't stop search before max_time elapsed */
77 uint32_t max_stop_time
;
78 int thinking
; /* engine is thinking now */
79 pthread_t tid
; /* thread id */
81 int pawn_hash_size
; /* size of pawn hash table */
82 int main_hash_size
; /* size of main hash table */
83 int pawn_hash_enabled
; /* use pawn hashtable */
84 int main_hash_enabled
; /* use main hashtable */
86 int resign
; /* if TRUE engine resigs in bad positions */
87 int resign_value
; /* resign if score is worse than this value */
88 int hopeless_moves
; /* moves that made after score worse than
98 pthread_mutex_t mutex
;
101 extern struct engine_t e
;
103 /* polyglot opening book functions */
104 void book_close(void);
105 void book_open(const char file_name
[]);
109 void print_stats(int timediff
);
110 void start_engine(void);
111 void perform_cleanup(void);
114 int check_time(int ply
);
115 uint32_t get_time(void);
116 int get_engine_value(int *val
);
117 void set_engine_value(int *src
, int new_value
);
119 /* these functions run in separate threads */
120 void *process_turn(void *args
);
121 void *run_epd_test(void *args
);