void cmd_default_weights(char *s) { free(base_weights); setup_default_weights(); }
int main(int argc, char**argv) { char *savedgame = NULL; int usesignal = 1; int i; setupfilenames(); for (i=1;i<argc;i++) { if (!strcmp(argv[i], "-load")) savedgame = argv[++i]; else if (!strcmp(argv[i], "-xsignal")) usesignal = 0; else if (!strcmp(argv[i], "-book")) bookfile = argv[++i]; else if (!strcmp(argv[i], "-binbook")) { binary_book = 1; bookfile = "book.bin"; } else if (!strcmp(argv[i], "-weights")) weightfile = argv[++i]; else if (!strcmp(argv[i], "-xbook")) book_mode = 0; else if (!strcmp(argv[i], "-xweights")) weight_mode = 0; else if (!strcmp(argv[i], "-seed")) { seed = atol(argv[++i]); seed_with_time = 0; } else printf("unknown command line switch: %s\n", argv[i]); } printf("Book: %s\n", bookfile); printf("Weight: %s\n", weightfile); if (usesignal) signal(SIGINT, myhandler); atexit(exit_engine); /* turn off buffering */ setbuf(stdout, NULL); setbuf(stderr, NULL); if (!weight_mode||!load_weights(weightfile)) { if (weight_mode) fprintf(stderr,"main: could not load weights, using defaults\n"); else printf("ignoreing weight file, using defaults\n"); setup_default_weights(); } board = malloc(sizeof(chessboard)); /* default seed for binary book */ seed_rng(DEFAULT_RANDOM_SEED); compute_randoms(); /* randomize for random book moves */ seed_randoms(); for (;;) { if (!savedgame) initialize(); else cmd_load(savedgame-1); playchess(); } return 0; }