RCS file: /sources/gnugo/gnugo/engine/board.c,v
retrieving revision 1.119
diff -u -r1.119 board.c
|
|
|
|
| 425 | 425 | |
| 426 | 426 | memset(board, EMPTY, sizeof(board)); |
| 427 | 427 | memset(initial_board, EMPTY, sizeof(initial_board)); |
| 428 | | for (k = 0; k < BOARDSIZE; k++) { |
| | 428 | for (k = 0; k < BOARDSIZE; ++k) { |
| 429 | 429 | if (!ON_BOARD2(I(k), J(k))) { |
| 430 | 430 | board[k] = GRAY; |
| 431 | 431 | initial_board[k] = GRAY; |
| 432 | 432 | } |
| 433 | 433 | } |
| 434 | 434 | |
| | 435 | board_nextrow = MAX_BOARD - board_size + 2; |
| | 436 | |
| 435 | 437 | board_ko_pos = NO_MOVE; |
| 436 | 438 | white_captured = 0; |
| 437 | 439 | black_captured = 0; |
| … |
… |
|
| 448 | 450 | |
| 449 | 451 | handicap = 0; |
| 450 | 452 | |
| 451 | | hashdata_recalc(&board_hash, board, board_ko_pos); |
| | 453 | hashdata_recalc(&board_hash, board, NO_MOVE); |
| 452 | 454 | new_position(); |
| 453 | 455 | } |
| 454 | 456 | |
| … |
… |
|
| 1026 | 1028 | /* Return the last move done by anyone. Both if no move was found or |
| 1027 | 1029 | * if the last move was a pass, PASS_MOVE is returned. |
| 1028 | 1030 | */ |
| 1029 | | int |
| | 1031 | inline int |
| 1030 | 1032 | get_last_move() |
| 1031 | 1033 | { |
| 1032 | 1034 | if (move_history_pointer == 0) |
| … |
… |
|
| 3149 | 3151 | int pos; |
| 3150 | 3152 | white_stones = 0; |
| 3151 | 3153 | black_stones = 0; |
| 3152 | | for (pos = BOARDMIN; pos < BOARDMAX; pos++) { |
| | 3154 | scan_board(pos, |
| 3153 | 3155 | if (board[pos] == WHITE) |
| 3154 | 3156 | white_stones++; |
| 3155 | 3157 | else if (board[pos] == BLACK) |
| 3156 | 3158 | black_stones++; |
| 3157 | | } |
| | 3159 | ) |
| 3158 | 3160 | |
| 3159 | 3161 | stone_count_for_position = position_number; |
| 3160 | 3162 | } |
| … |
… |
|
| 3206 | 3208 | int pos; |
| 3207 | 3209 | int s; |
| 3208 | 3210 | |
| 3209 | | position_number++; |
| | 3211 | ++position_number; |
| 3210 | 3212 | next_string = 0; |
| 3211 | 3213 | liberty_mark = 0; |
| 3212 | 3214 | string_mark = 0; |
| … |
… |
|
| 3221 | 3223 | /* propagate_string relies on non-assigned stones to have |
| 3222 | 3224 | * string_number -1. |
| 3223 | 3225 | */ |
| 3224 | | for (pos = BOARDMIN; pos < BOARDMAX; pos++) |
| 3225 | | if (ON_BOARD(pos)) |
| 3226 | | string_number[pos] = -1; |
| | 3226 | scan_board(pos, |
| | 3227 | string_number[pos] = -1; |
| | 3228 | ) |
| 3227 | 3229 | |
| 3228 | 3230 | /* Find the existing strings. */ |
| 3229 | | for (pos = BOARDMIN; pos < BOARDMAX; pos++) { |
| 3230 | | if (!ON_BOARD(pos)) |
| 3231 | | continue; |
| | 3231 | scan_board(pos, |
| 3232 | 3232 | if (IS_STONE(board[pos]) && string_number[pos] == -1) { |
| 3233 | 3233 | string_number[pos] = next_string; |
| 3234 | 3234 | string[next_string].size = propagate_string(pos, pos); |
| 3235 | 3235 | string[next_string].color = board[pos]; |
| 3236 | 3236 | string[next_string].origin = pos; |
| 3237 | 3237 | string[next_string].mark = 0; |
| 3238 | | next_string++; |
| | 3238 | ++next_string; |
| 3239 | 3239 | PARANOID1(next_string < MAX_STRINGS, pos); |
| 3240 | 3240 | } |
| 3241 | | } |
| | 3241 | ) |
| 3242 | 3242 | |
| 3243 | 3243 | /* Fill in liberty and neighbor info. */ |
| 3244 | | for (s = 0; s < next_string; s++) { |
| | 3244 | for (s = 0; s < next_string; ++s) { |
| 3245 | 3245 | find_liberties_and_neighbors(s); |
| 3246 | 3246 | } |
| 3247 | 3247 | } |
| … |
… |
|
| 3260 | 3260 | int s; |
| 3261 | 3261 | int i; |
| 3262 | 3262 | |
| 3263 | | for (pos = BOARDMIN; pos < BOARDMAX; pos++) { |
| 3264 | | if (!ON_BOARD(pos)) |
| 3265 | | continue; |
| | 3263 | scan_board(pos, |
| 3266 | 3264 | if (board[pos] == EMPTY) |
| 3267 | 3265 | fprintf(stderr, " . "); |
| 3268 | 3266 | else |
| 3269 | 3267 | fprintf(stderr, "%2d ", string_number[pos]); |
| 3270 | 3268 | fprintf(stderr, "\n"); |
| 3271 | | } |
| | 3269 | ) |
| 3272 | 3270 | |
| 3273 | 3271 | for (s = 0; s < next_string; s++) { |
| 3274 | 3272 | if (board[string[s].origin] == EMPTY) |