Ticket #132: gunnar_7_10.13.diff
| File gunnar_7_10.13.diff, 22.1 kB (added by gunnar, 3 years ago) |
|---|
-
engine/board.c
RCS file: /cvsroot/gnugo/gnugo/engine/board.c,v retrieving revision 1.118 diff -u -r1.118 board.c
300 300 301 301 302 302 /* Forward declarations. */ 303 static void really_do_trymove(int pos, int color); 303 304 static int do_trymove(int pos, int color, int ignore_ko); 304 305 static void undo_trymove(void); 305 306 … … 307 308 static int slow_approxlib(int pos, int color, int maxlib, int *libs); 308 309 static int do_accuratelib(int pos, int color, int maxlib, int *libs); 309 310 311 static int is_superko_violation(int pos, int color, enum ko_rules type); 312 310 313 static void new_position(void); 311 314 static int propagate_string(int stone, int str); 312 315 static void find_liberties_and_neighbors(int s); … … 360 363 for (k = 0; k < move_history_pointer; k++) { 361 364 state->move_history_color[k] = move_history_color[k]; 362 365 state->move_history_pos[k] = move_history_pos[k]; 366 state->move_history_hash[k] = move_history_hash[k]; 363 367 } 364 368 365 369 state->komi = komi; … … 396 400 for (k = 0; k < move_history_pointer; k++) { 397 401 move_history_color[k] = state->move_history_color[k]; 398 402 move_history_pos[k] = state->move_history_pos[k]; 403 move_history_hash[k] = state->move_history_hash[k]; 399 404 } 400 405 401 406 komi = state->komi; … … 598 603 return 1; 599 604 } 600 605 606 /* Really, really make a temporary move. It is assumed that all 607 * necessary checks have already been made and likewise that various 608 * administrative bookkeeping outside of the actual board logic has 609 * either been done or is not needed. 610 */ 611 static void 612 really_do_trymove(int pos, int color) 613 { 614 BEGIN_CHANGE_RECORD(); 615 PUSH_VALUE(board_ko_pos); 616 617 /* 618 * FIXME: Do we really have to store board_hash in a stack? 619 * 620 * Answer: No, we don't. But for every stone that we add 621 * or remove, we must call hashdata_invert_stone(). This is 622 * not difficult per se, but the whole board.c 623 * will have to be checked, and there is lots of room 624 * for mistakes. 625 * 626 * At the same time, profiling shows that storing the 627 * hashdata in a stack doesn't take a lot of time, so 628 * this is not an urgent FIXME. 629 */ 630 memcpy(&board_hash_stack[stackp], &board_hash, sizeof(board_hash)); 631 632 if (board_ko_pos != NO_MOVE) 633 hashdata_invert_ko(&board_hash, board_ko_pos); 634 635 board_ko_pos = NO_MOVE; 636 637 stackp++; 638 639 if (pos != PASS_MOVE) { 640 PUSH_VALUE(black_captured); 641 PUSH_VALUE(white_captured); 642 do_play_move(pos, color); 643 } 644 } 601 645 602 646 /* 603 647 * Do the main work of trymove() and tryko(), i.e. the common parts. … … 663 707 stack[stackp] = pos; 664 708 move_color[stackp] = color; 665 709 666 /* 667 * FIXME: Do we really have to store board_hash in a stack? 668 * 669 * Answer: No, we don't. But for every stone that we add 670 * or remove, we must call hashdata_invert_stone(). This is 671 * not difficult per se, but the whole board.c 672 * will have to be checked, and there is lots of room 673 * for mistakes. 674 * 675 * At the same time, profiling shows that storing the 676 * hashdata in a stack doesn't take a lot of time, so 677 * this is not an urgent FIXME. 678 */ 679 BEGIN_CHANGE_RECORD(); 680 PUSH_VALUE(board_ko_pos); 681 memcpy(&board_hash_stack[stackp], &board_hash, sizeof(board_hash)); 682 683 if (board_ko_pos != NO_MOVE) 684 hashdata_invert_ko(&board_hash, board_ko_pos); 685 686 board_ko_pos = NO_MOVE; 687 688 stackp++; 689 690 if (pos != PASS_MOVE) { 691 PUSH_VALUE(black_captured); 692 PUSH_VALUE(white_captured); 693 do_play_move(pos, color); 694 } 710 really_do_trymove(pos, color); 695 711 696 712 return 1; 697 713 } … … 704 720 void 705 721 popgo() 706 722 { 707 stackp--;708 709 723 undo_trymove(); 710 724 711 memcpy(&board_hash, &(board_hash_stack[stackp]), sizeof(board_hash));712 713 725 if (sgf_dumptree) { 714 726 char buf[100]; 715 727 int is_tryko = 0; … … 733 745 } 734 746 735 747 736 #if 0737 738 /* Silent version of popgo(), suitable for use if you have called739 * do_trymove() without passing through trymove() or tryko().740 */741 742 static void743 silent_popgo(void)744 {745 stackp--;746 undo_trymove();747 memcpy(&board_hash, &(board_hash_stack[stackp]), sizeof(board_hash));748 }749 750 #endif751 752 748 /* Restore board state to the position before the last move. This is 753 749 * accomplished by popping everything that was stored on the stacks 754 * since the last BEGIN_CHANGE_RECORD(). 750 * since the last BEGIN_CHANGE_RECORD(). Also stackp is decreased and 751 * board hash is restored from stack. 752 * 753 * This undoes the effects of do_trymove() or really_do_trymove() and 754 * is appropriate to call instead of popgo() if you have not passed 755 * through trymove() or tryko(). 755 756 */ 756 757 757 758 static void … … 766 767 767 768 POP_MOVE(); 768 769 POP_VERTICES(); 770 771 stackp--; 772 memcpy(&board_hash, &(board_hash_stack[stackp]), sizeof(board_hash)); 769 773 } 770 774 771 775 … … 960 964 for (k = number_collapsed_moves; k < move_history_pointer; k++) { 961 965 move_history_color[k - number_collapsed_moves] = move_history_color[k]; 962 966 move_history_pos[k - number_collapsed_moves] = move_history_pos[k]; 967 move_history_hash[k - number_collapsed_moves] = move_history_hash[k]; 963 968 } 964 969 move_history_pointer -= number_collapsed_moves; 965 970 … … 972 977 973 978 move_history_color[move_history_pointer] = color; 974 979 move_history_pos[move_history_pointer] = pos; 980 move_history_hash[move_history_pointer] = board_hash; 981 if (board_ko_pos != NO_MOVE) 982 hashdata_invert_ko(&move_history_hash[move_history_pointer], board_ko_pos); 975 983 move_history_pointer++; 976 984 977 985 play_move_no_history(pos, color, 1); … … 1057 1065 1058 1066 1059 1067 /* 1060 * is_legal(pos, color) determines whether the move (color) at 1061 * pos is legal. 1068 * is_legal(pos, color) determines whether the move (color) at pos is 1069 * legal. This is for internal use in the engine and always assumes 1070 * that suicide is allowed and only simple ko restrictions, no 1071 * superko, regardless of the rules actually used in the game. 1072 * 1073 * Use is_allowed_move() if you want to take alternative suicide and 1074 * ko rules into account. 1062 1075 */ 1063 1076 1064 1077 int … … 1094 1107 } 1095 1108 1096 1109 /* Check for suicide. */ 1097 if ( !allow_suicide &&is_suicide(pos, color))1110 if (is_suicide(pos, color)) 1098 1111 return 0; 1099 1112 1100 1113 return 1; … … 1156 1169 || (board[EAST(pos)] == OTHER_COLOR(color)))); 1157 1170 } 1158 1171 1172 /* 1173 * is_allowed_move(int pos, int color) determines whether a move is 1174 * legal with respect to the suicide and ko rules in play. 1175 * 1176 * This function is only valid when stackp == 0 since there is no 1177 * tracking of superko for trymoves. 1178 */ 1179 int 1180 is_allowed_move(int pos, int color) 1181 { 1182 gg_assert(stackp == 0); 1183 1184 /* 1. A pass move is always legal, no matter what. */ 1185 if (pos == PASS_MOVE) 1186 return 1; 1187 1188 /* 2. The move must be inside the board. */ 1189 ASSERT_ON_BOARD1(pos); 1190 1191 /* 3. The location must be empty. */ 1192 if (board[pos] != EMPTY) 1193 return 0; 1194 1195 /* 4. Simple ko repetition is only allowed if no ko rule is in use. 1196 * For superko rules this check is redundant. 1197 */ 1198 if (ko_rule != NONE 1199 && pos == board_ko_pos 1200 && (board[WEST(pos)] == OTHER_COLOR(color) 1201 || board[EAST(pos)] == OTHER_COLOR(color))) 1202 return 0; 1203 1204 /* 5. Check for suicide. Suicide rule options: 1205 * FORBIDDEN - No suicides allowed. 1206 * ALLOWED - Suicide of more than one stone allowed. 1207 * ALL_ALLOWED - All suicides allowed. 1208 */ 1209 if (is_suicide(pos, color)) 1210 if (suicide_rule == FORBIDDEN 1211 || (suicide_rule == ALLOWED 1212 && !has_neighbor(pos, color))) 1213 return 0; 1214 1215 /* 6. Check for whole board repetitions. The superko options are 1216 * SIMPLE, NONE - No superko restrictions. 1217 * PSK - Repetition of a previous position forbidden. 1218 * SSK - Repetition of a previous position with the same 1219 * player to move forbidden. 1220 */ 1221 if (is_superko_violation(pos, color, ko_rule)) 1222 return 0; 1223 1224 return 1; 1225 } 1226 1159 1227 /* Necessary work to set the new komaster state. */ 1160 1228 static void 1161 1229 set_new_komaster(int new_komaster) … … 2937 3005 return 0; 2938 3006 } 2939 3007 3008 static int 3009 is_superko_violation(int pos, int color, enum ko_rules type) 3010 { 3011 Hash_data this_board_hash = board_hash; 3012 Hash_data new_board_hash; 3013 int k; 3014 3015 /* No superko violations if the ko rule is not a superko rule. */ 3016 if (type == NONE || type == SIMPLE) 3017 return 0; 3018 3019 if (board_ko_pos != NO_MOVE) 3020 hashdata_invert_ko(&this_board_hash, board_ko_pos); 3021 3022 really_do_trymove(pos, color); 3023 new_board_hash = board_hash; 3024 if (board_ko_pos != NO_MOVE) 3025 hashdata_invert_ko(&new_board_hash, board_ko_pos); 3026 undo_trymove(); 3027 3028 /* The current position is only a problem with positional superko 3029 * and a single stone suicide. 3030 */ 3031 if (type == PSK && hashdata_is_equal(this_board_hash, new_board_hash)) 3032 return 1; 3033 3034 for (k = move_history_pointer - 1; k >= 0; k--) 3035 if (hashdata_is_equal(move_history_hash[k], new_board_hash) 3036 && (type == PSK 3037 || move_history_color[k] == OTHER_COLOR(color))) 3038 return 1; 3039 3040 return 0; 3041 } 2940 3042 2941 3043 /* Returns 1 if at least one string is captured when color plays at pos. 2942 3044 */ -
engine/board.h
RCS file: /cvsroot/gnugo/gnugo/engine/board.h,v retrieving revision 1.33 diff -u -r1.33 board.h
23 23 #ifndef _BOARD_H_ 24 24 #define _BOARD_H_ 25 25 26 #include <stdarg.h> 27 #include "config.h" 26 28 #include "sgftree.h" 27 29 #include "winsocket.h" 28 #include "config.h" 29 #include <stdarg.h> 30 31 /* This type is used to store each intersection on the board. 32 * 33 * On a 486, char is best, since the time taken to push and pop 34 * becomes significant otherwise. On other platforms, an int may 35 * be better, e.g. if memcpy() is particularly fast, or if 36 * character access is very slow. 37 */ 38 39 typedef unsigned char Intersection; 40 41 /* FIXME: This is very ugly but we can't include hash.h until we have 42 * defined Intersection. And we do need to include it before using 43 * Hash_data. 44 */ 45 #include "hash.h" 30 46 31 47 /* local versions of absolute value, min and max */ 32 48 … … 117 133 #define OTHER_COLOR(color) (WHITE+BLACK-(color)) 118 134 #define IS_STONE(arg) ((arg) == WHITE || (arg) == BLACK) 119 135 120 /* This type is used to store each intersection on the board.121 *122 * On a 486, char is best, since the time taken to push and pop123 * becomes significant otherwise. On other platforms, an int may124 * be better, e.g. if memcpy() is particularly fast, or if125 * character access is very slow.126 */127 128 typedef unsigned char Intersection;129 130 131 132 136 /* Note that POS(-1, -1) == 0 133 137 * DELTA() is defined so that POS(i+di, j+dj) = POS(i, j) + DELTA(di, dj). 134 138 */ … … 190 194 extern int initial_black_captured; 191 195 extern int move_history_color[MAX_MOVE_HISTORY]; 192 196 extern int move_history_pos[MAX_MOVE_HISTORY]; 197 extern Hash_data move_history_hash[MAX_MOVE_HISTORY]; 193 198 extern int move_history_pointer; 194 199 195 200 extern float komi; … … 198 203 199 204 extern signed char shadow[BOARDMAX]; /* reading tree shadow */ 200 205 201 extern int chinese_rules; 202 extern int allow_suicide; 206 enum suicide_rules { 207 FORBIDDEN, 208 ALLOWED, 209 ALL_ALLOWED 210 }; 211 extern enum suicide_rules suicide_rule; 212 213 enum ko_rules { 214 SIMPLE, 215 NONE, 216 PSK, 217 SSK 218 }; 219 extern enum ko_rules ko_rule; 220 203 221 204 222 extern int stackp; /* stack pointer */ 205 223 extern int count_variations; /* count (decidestring) */ … … 221 239 int initial_black_captured; 222 240 int move_history_color[MAX_MOVE_HISTORY]; 223 241 int move_history_pos[MAX_MOVE_HISTORY]; 242 Hash_data move_history_hash[MAX_MOVE_HISTORY]; 224 243 int move_history_pointer; 225 244 226 245 float komi; … … 280 299 int is_legal(int pos, int color); 281 300 int is_suicide(int pos, int color); 282 301 int is_illegal_ko_capture(int pos, int color); 302 int is_allowed_move(int pos, int color); 283 303 int is_ko(int pos, int color, int *ko_pos); 284 304 int is_ko_point(int pos); 285 305 int does_capture_something(int pos, int color); -
engine/boardlib.c
RCS file: /cvsroot/gnugo/gnugo/engine/boardlib.c,v retrieving revision 1.11 diff -u -r1.11 boardlib.c
39 39 int initial_black_captured; 40 40 int move_history_color[MAX_MOVE_HISTORY]; 41 41 int move_history_pos[MAX_MOVE_HISTORY]; 42 Hash_data move_history_hash[MAX_MOVE_HISTORY]; 42 43 int move_history_pointer; 43 44 44 45 float komi = 0.0; 45 46 int handicap = 0; 46 47 int movenum; 47 int allow_suicide = 0; /* allow opponent to make suicide moves */ 48 enum suicide_rules suicide_rule = FORBIDDEN; 49 enum ko_rules ko_rule = SIMPLE; 48 50 49 51 50 52 signed char shadow[BOARDMAX]; -
engine/genmove.c
RCS file: /cvsroot/gnugo/gnugo/engine/genmove.c,v retrieving revision 1.114 diff -u -r1.114 genmove.c
508 508 } 509 509 } 510 510 511 /* If we somehow have managed to generate an illegal move, pass instead. */ 512 if (!is_allowed_move(move, color)) { 513 TRACE("ILLEGAL MOVE GENERATED. Passing instead.\n"); 514 move = PASS_MOVE; 515 *value = -1.0; 516 } 517 511 518 /* If no move is found then pass. */ 512 519 if (move == PASS_MOVE) { 513 520 TRACE("I pass.\n"); -
engine/value_moves.c
RCS file: /cvsroot/gnugo/gnugo/engine/value_moves.c,v retrieving revision 1.168 diff -u -r1.168 value_moves.c
3421 3421 3422 3422 ko_move_target = get_biggest_owl_target(ko_move); 3423 3423 3424 /* Find the ko stone. */ 3425 for (k = 0; k <= 3; k++) { 3426 ko_stone = ko_move + delta[k]; 3427 if (ON_BOARD(ko_stone) && countlib(ko_stone) == 1) 3428 break; 3424 /* If the move is a simple ko recapture, find the ko stone. (If 3425 * it's not a simple ko recapture, then the move must be a superko 3426 * violation.) 3427 */ 3428 if (is_illegal_ko_capture(ko_move, color)) { 3429 for (k = 0; k <= 3; k++) { 3430 ko_stone = ko_move + delta[k]; 3431 if (ON_BOARD(ko_stone) && countlib(ko_stone) == 1) 3432 break; 3433 } 3434 ASSERT_ON_BOARD1(ko_stone); 3429 3435 } 3430 ASSERT_ON_BOARD1(ko_stone);3431 3436 3432 3437 TRACE("Reevaluating ko threats.\n"); 3433 3438 for (pos = BOARDMIN; pos < BOARDMAX; pos++) { … … 3491 3496 /* If there is no threat recorded, the followup value is probably 3492 3497 * contributed by a pattern. We can do nothing but accept this value. 3493 3498 * (although this does cause problems). 3499 * 3500 * FIXME: In the case of superko violation we have no ko_stone. 3501 * Presumably some of the tests below should be applicable anyway. 3502 * Currently we just say that any threat is ok. 3494 3503 */ 3495 if (type == -1 )3504 if (type == -1 || ko_stone == NO_MOVE) 3496 3505 threat_does_work = 1; 3497 3506 else { 3498 3507 if (trymove(pos, color, "reevaluate_ko_threats", ko_move)) { … … 3686 3695 /* If the best move is an illegal ko capture, reevaluate ko 3687 3696 * threats and search again. 3688 3697 */ 3689 if (best_value > 0.0 && is_illegal_ko_capture(best_move, color)) { 3698 if (best_value > 0.0 3699 && (is_illegal_ko_capture(best_move, color) 3700 || !is_allowed_move(best_move, color))) { 3690 3701 TRACE("Move at %1m would be an illegal ko capture.\n", best_move); 3691 3702 reevaluate_ko_threats(best_move, color, best_value); 3692 3703 redistribute_points(); -
interface/main.c
RCS file: /cvsroot/gnugo/gnugo/interface/main.c,v retrieving revision 1.133 diff -u -r1.133 main.c
143 143 OPT_OWL_THREATS, 144 144 OPT_NO_OWL_THREATS, 145 145 OPT_JAPANESE_RULES, 146 OPT_FORBID_SUICIDE, 146 147 OPT_ALLOW_SUICIDE, 148 OPT_ALLOW_ALL_SUICIDE, 149 OPT_SIMPLE_KO, 150 OPT_NO_KO, 151 OPT_POSITIONAL_SUPERKO, 152 OPT_SITUATIONAL_SUPERKO, 147 153 OPT_CAPTURE_ALL_DEAD, 148 154 OPT_PLAY_OUT_AFTERMATH, 149 155 OPT_MIRROR, … … 249 255 {"standard-connections", no_argument, 0, OPT_STANDARD_CONNECTIONS}, 250 256 {"standard-semeai", no_argument, 0, OPT_STANDARD_SEMEAI}, 251 257 {"alternate-connections", no_argument, 0, OPT_ALTERNATE_CONNECTIONS}, 252 {"with-break-in", no_argument, 0, OPT_WITH_BREAK_IN}, 253 {"without-break-in", no_argument, 0, OPT_WITHOUT_BREAK_IN}, 254 {"cosmic-gnugo", no_argument, 0, OPT_COSMIC_GNUGO}, 255 {"no-cosmic-gnugo", no_argument, 0, OPT_NO_COSMIC_GNUGO}, 256 {"large-scale", no_argument, 0, OPT_LARGE_SCALE}, 257 {"no-large-scale", no_argument, 0, OPT_NO_LARGE_SCALE}, 258 {"options", no_argument, 0, OPT_OPTIONS}, 259 {"allow-suicide", no_argument, 0, OPT_ALLOW_SUICIDE}, 260 {"capture-all-dead", no_argument, 0, OPT_CAPTURE_ALL_DEAD}, 261 {"play-out-aftermath", no_argument, 0, OPT_PLAY_OUT_AFTERMATH}, 258 {"with-break-in", no_argument, 0, OPT_WITH_BREAK_IN}, 259 {"without-break-in", no_argument, 0, OPT_WITHOUT_BREAK_IN}, 260 {"cosmic-gnugo", no_argument, 0, OPT_COSMIC_GNUGO}, 261 {"no-cosmic-gnugo", no_argument, 0, OPT_NO_COSMIC_GNUGO}, 262 {"large-scale", no_argument, 0, OPT_LARGE_SCALE}, 263 {"no-large-scale", no_argument, 0, OPT_NO_LARGE_SCALE}, 264 {"options", no_argument, 0, OPT_OPTIONS}, 265 {"forbid-suicide", no_argument, 0, OPT_FORBID_SUICIDE}, 266 {"allow-suicide", no_argument, 0, OPT_ALLOW_SUICIDE}, 267 {"allow-all-suicide", no_argument, 0, OPT_ALLOW_ALL_SUICIDE}, 268 {"simple-ko", no_argument, 0, OPT_SIMPLE_KO}, 269 {"no-ko", no_argument, 0, OPT_NO_KO}, 270 {"positional-superko", no_argument, 0, OPT_POSITIONAL_SUPERKO}, 271 {"situational-superko", no_argument, 0, OPT_SITUATIONAL_SUPERKO}, 272 {"capture-all-dead", no_argument, 0, OPT_CAPTURE_ALL_DEAD}, 273 {"play-out-aftermath", no_argument, 0, OPT_PLAY_OUT_AFTERMATH}, 262 274 {"cache-size", required_argument, 0, 'M'}, 263 275 {"worms", no_argument, 0, 'w'}, 264 276 {"moyo", required_argument, 0, 'm'}, … … 583 595 large_scale = 0; 584 596 break; 585 597 598 case OPT_FORBID_SUICIDE: 599 suicide_rule = FORBIDDEN; 600 break; 601 586 602 case OPT_ALLOW_SUICIDE: 587 allow_suicide = 1; 603 suicide_rule = ALLOWED; 604 break; 605 606 case OPT_ALLOW_ALL_SUICIDE: 607 suicide_rule = ALL_ALLOWED; 608 break; 609 610 case OPT_SIMPLE_KO: 611 ko_rule = SIMPLE; 612 break; 613 614 case OPT_NO_KO: 615 ko_rule = NONE; 616 break; 617 618 case OPT_POSITIONAL_SUPERKO: 619 ko_rule = PSK; 620 break; 621 622 case OPT_SITUATIONAL_SUPERKO: 623 ko_rule = SSK; 588 624 break; 589 625 590 626 case OPT_CAPTURE_ALL_DEAD: … … 1441 1477 \n\ 1442 1478 --japanese-rules (default)\n\ 1443 1479 --chinese-rules\n\ 1444 --allow-suicide\n\ 1480 --forbid-suicide Forbid suicide. (default)\n\ 1481 --allow-suicide Allow suicide except single-stone suicide.\n\ 1482 --allow-all-suicide Allow all suicide moves.\n\ 1483 --simple-ko Forbid simple ko recapture. (default)\n\ 1484 --no-ko Allow any ko recapture.\n\ 1485 --positional-superko Positional superko restrictions.\n\ 1486 --situational-superko Situational superko restrictions.\n\ 1445 1487 \n\ 1446 1488 --play-out-aftermath\n\ 1447 1489 --capture-all-dead\n\ -
interface/play_ascii.c
RCS file: /cvsroot/gnugo/gnugo/interface/play_ascii.c,v retrieving revision 1.70 diff -u -r1.70 play_ascii.c
520 520 return 0; 521 521 } 522 522 523 if (!is_ legal(move, gameinfo->to_move)) {523 if (!is_allowed_move(move, gameinfo->to_move)) { 524 524 printf("\nIllegal move: %s", command); 525 525 return 0; 526 526 } -
interface/play_gtp.c
RCS file: /cvsroot/gnugo/gnugo/interface/play_gtp.c,v retrieving revision 1.181 diff -u -r1.181 play_gtp.c
605 605 else if (!gtp_decode_coord(s, &i, &j)) 606 606 return gtp_failure("invalid coordinate"); 607 607 608 if (!is_ legal(POS(i, j), BLACK))608 if (!is_allowed_move(POS(i, j), BLACK)) 609 609 return gtp_failure("illegal move"); 610 610 611 611 gnugo_play_move(POS(i, j), BLACK); … … 636 636 else if (!gtp_decode_coord(s, &i, &j)) 637 637 return gtp_failure("invalid coordinate"); 638 638 639 if (!is_ legal(POS(i, j), WHITE))639 if (!is_allowed_move(POS(i, j), WHITE)) 640 640 return gtp_failure("illegal move"); 641 641 642 642 gnugo_play_move(POS(i, j), WHITE); … … 660 660 if (!gtp_decode_move(s, &color, &i, &j)) 661 661 return gtp_failure("invalid color or coordinate"); 662 662 663 if (!is_ legal(POS(i, j), color))663 if (!is_allowed_move(POS(i, j), color)) 664 664 return gtp_failure("illegal move"); 665 665 666 666 gnugo_play_move(POS(i, j), color); … … 1025 1025 if (!gtp_decode_move(s, &color, &i, &j)) 1026 1026 return gtp_failure("invalid color or coordinate"); 1027 1027 1028 return gtp_success("%d", is_ legal(POS(i, j), color));1028 return gtp_success("%d", is_allowed_move(POS(i, j), color)); 1029 1029 } 1030 1030 1031 1031 … … 1048 1048 1049 1049 for (i = 0; i < board_size; i++) 1050 1050 for (j = 0; j < board_size; j++) 1051 if (BOARD(i, j) == EMPTY && is_ legal(POS(i, j), color)) {1051 if (BOARD(i, j) == EMPTY && is_allowed_move(POS(i, j), color)) { 1052 1052 movei[moves] = i; 1053 1053 movej[moves++] = j; 1054 1054 } -
interface/play_solo.c
RCS file: /cvsroot/gnugo/gnugo/interface/play_solo.c,v retrieving revision 1.44 diff -u -r1.44 play_solo.c
69 69 do { 70 70 i = (gg_rand() % 4) + (gg_rand() % (board_size - 4)); 71 71 j = (gg_rand() % 4) + (gg_rand() % (board_size - 4)); 72 } while (!is_ legal(POS(i, j), gameinfo->to_move));72 } while (!is_allowed_move(POS(i, j), gameinfo->to_move)); 73 73 74 74 gnugo_play_move(POS(i, j), gameinfo->to_move); 75 75 sgftreeAddPlay(&sgftree, gameinfo->to_move, i, j);
