search: fixed a bug in NULL move pruning
[owl.git] / main.c
blobb93c5514f9fd174c15d479ddb8825a273fb86794
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.
16 #include "common.h"
17 #include "init.h"
18 #include "engine.h"
19 #include "trans.h"
21 /* engine name */
22 char program_name[MAX_STRING];
24 int main(int argc, char **argv)
26 int opt;
28 #ifdef STATISTIC_COUNTERS
29 snprintf(program_name, MAX_STRING, "owl %s, build %s", PACKAGE_VERSION, __DATE__);
30 #else
31 snprintf(program_name, MAX_STRING, "owl %s", PACKAGE_VERSION);
32 #endif
33 /* turn off I/O buffering */
34 setbuf(stdin, 0);
35 setbuf(stdout, 0);
37 initialize_bitboards();
38 initialize_zobrist();
40 start_engine();
42 /* parse command line parameters */
43 while ((opt = getopt(argc, argv, "h:p:")) != -1)
44 switch (opt) {
45 case 'h':
46 if ((e.main_hash_size = atoi(optarg)) <= 0)
47 e.main_hash_enabled = FALSE;
48 break;
49 case 'p':
50 if ((e.pawn_hash_size = atoi(optarg)) <= 0)
51 e.pawn_hash_enabled = FALSE;
52 break;
55 /* allocate memory for hashtables */
56 if (initialize_pawn_hashtable()) {
57 e.pawn_hash_enabled = FALSE;
58 fprintf(stderr, "Can't allocate pawn hashtable!\n");
60 if (initialize_main_hashtable()) {
61 e.main_hash_enabled = FALSE;
62 fprintf(stderr, "Can't allocate main hashtable!\n");
65 /* clear transposition tables */
66 clear_pawn_hashtable();
67 clear_main_hashtable();
69 loopcmd();
71 return 0;