Ticket #194: gunnar_7_12.2.diff
| File gunnar_7_12.2.diff, 3.8 KB (added by gunnar, 2 years ago) |
|---|
-
interface/play_gmp.c
103 103 } 104 104 105 105 gameinfo->handicap = gmp_handicap(ge); 106 if (!check_boardsize(gmp_size(ge), stderr)) 107 exit(EXIT_FAILURE); 108 106 109 gnugo_clear_board(gmp_size(ge)); 107 110 108 111 /* Let's pretend GMP knows about komi in case something will ever change. */ -
interface/play_ascii.c
715 715 printf("\nInvalid command syntax!\n"); 716 716 break; 717 717 } 718 if (num < MIN_BOARD || num > MAX_BOARD) { 719 printf("\nInvalid board size: %d\n", num); 718 if (!check_boardsize(num, stdout)) 720 719 break; 721 }722 720 /* Init board. */ 723 721 board_size = num; 724 722 clear_board(); -
interface/play_gtp.c
442 442 if (sscanf(s, "%d", &boardsize) < 1) 443 443 return gtp_failure("boardsize not an integer"); 444 444 445 if ( boardsize < MIN_BOARD || boardsize > MAX_BOARD) {445 if (!check_boardsize(boardsize, NULL)) { 446 446 if (gtp_version == 1) 447 447 return gtp_failure("unacceptable boardsize"); 448 448 else -
interface/main.c
510 510 case OPT_BOARDSIZE: 511 511 { 512 512 int boardsize = atoi(gg_optarg); 513 514 if (boardsize < MIN_BOARD || boardsize > MAX_BOARD) { 515 fprintf(stderr, "Unsupported board size: %d. ", boardsize); 516 if (boardsize < MIN_BOARD) 517 fprintf(stderr, "Min size is %d.\n", MIN_BOARD); 518 else 519 fprintf(stderr, "Max size is %d.\n", MAX_BOARD); 520 fprintf(stderr, "Try `gnugo --help' for more information.\n"); 513 514 if (!check_boardsize(boardsize, stderr)) 521 515 exit(EXIT_FAILURE); 522 }516 523 517 gnugo_clear_board(boardsize); 524 518 break; 525 519 } -
engine/interface.c
60 60 61 61 /* ---------------------------------------------------------------- */ 62 62 63 /* Check whether we can accept a certain boardsize. Set out to NULL to 64 * suppress informative messages. Return 1 for an acceptable 65 * boardsize, 0 otherwise. 66 */ 67 int check_boardsize(int boardsize, FILE *out) 68 { 69 if (boardsize < MIN_BOARD || boardsize > MAX_BOARD) { 70 if (out) { 71 fprintf(out, "Unsupported board size: %d. ", boardsize); 72 if (boardsize < MIN_BOARD) 73 fprintf(out, "Min size is %d.\n", MIN_BOARD); 74 else 75 fprintf(out, "Max size is %d.\n", MAX_BOARD); 76 fprintf(out, "Try `gnugo --help' for more information.\n"); 77 } 78 return 0; 79 } 80 81 return 1; 82 } 83 63 84 /* 64 85 * Clear the board. 65 86 */ … … 245 266 246 267 if (!sgfGetIntProperty(tree->root, "SZ", &bs)) 247 268 bs = 19; 248 249 if (bs < MIN_BOARD || bs > MAX_BOARD) { 250 if (bs < MIN_BOARD) 251 gprintf("Boardsize too small.\n"); 252 else 253 gprintf("Boardsize too large.\n"); 254 269 270 if (!check_boardsize(bs, stderr)) 255 271 return EMPTY; 256 }257 272 258 273 handicap = 0; 259 274 if (sgfGetIntProperty(tree->root, "HA", &handicap) && handicap > 1) -
engine/gnugo.h
85 85 /* ================================================================ */ 86 86 87 87 88 int check_boardsize(int boardsize, FILE *out); 88 89 void gnugo_clear_board(int boardsize); 89 90 void gnugo_play_move(int move, int color); 90 91 int gnugo_play_sgfnode(SGFNode *node, int to_move);
