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 lazy_evaluations
;
32 uint64_t failed_high_first
;
33 uint64_t failed_high_total
;
34 uint64_t futility_prunings
;
35 uint64_t null_move_prunings
;
37 uint64_t pawn_hash_evaluations
;
40 uint64_t searched_nodes
;
41 uint64_t transposition
;
44 extern int history
[2][7][4096]; /* cut off history */
45 extern int hash_moves
[MAX_PLY
]; /* moves from transposition
46 table (searched first) */
47 extern struct killers_t killers
[MAX_PLY
];
48 extern struct counters_t counters
;
50 extern int pv
[MAX_PLY
][MAX_PLY
];
51 extern int pv_length
[MAX_PLY
];
52 extern char return_ponder
[32];
55 char *filename
; /* filename of .epd file. we should free this pointer
56 after completing tests */
57 int think_time
; /* time in seconds for each position */
58 int max_tests
; /* max number of tests to do */
59 int first_test
; /* start from */
63 int side
; /* what engine's side */
69 int play_computer
; /* playing with a computer engine */
70 int san_notation
; /* output thinking using SAN notation */
71 int ponder_allowed
; /* allow pondering - disabled by 'easy' xboard command */
73 int max_depth
; /* max search depth */
74 int max_time
; /* max search time */
75 int inc_time
; /* add time after move */
77 int chk_time
; /* check for exit every chk_time nodes */
78 int time_div
; /* assume all time for time_div moves */
79 int fixed_time
; /* don't stop search before max_time elapsed */
81 uint32_t max_stop_time
;
82 int thinking
; /* engine is thinking now */
83 int pondering
; /* engine is pondering now */
85 pthread_t tid
; /* thread id */
87 int pawn_hash_size
; /* size of pawn hash table */
88 int main_hash_size
; /* size of main hash table */
89 int pawn_hash_enabled
; /* use pawn hashtable */
90 int main_hash_enabled
; /* use main hashtable */
92 int resign
; /* if TRUE engine resigs in bad positions */
93 int resign_value
; /* resign if score is worse than this value */
94 int hopeless_moves
; /* moves that made after score worse than
104 pthread_mutex_t mutex
;
105 pthread_mutex_t ponder_mutex
;
108 extern struct engine_t e
;
109 extern struct parsed_moves_t pm
;
110 extern pthread_cond_t cond_exit
;
112 /* polyglot opening book functions */
113 void book_close(void);
114 void book_open(const char file_name
[]);
118 void print_stats(int timediff
);
119 void start_engine(void);
120 void perform_cleanup(void);
123 int check_time(int ply
);
124 uint32_t get_time(void);
125 int get_engine_value(int *val
);
126 void set_engine_value(int *src
, int new_value
);
128 /* these functions run in separate threads */
129 void *process_turn(void *args
);
130 void *run_epd_test(void *args
);