Ticket #145: board.c.patch

File board.c.patch, 2.9 kB (added by draqo, 2 years ago)
  • gnugo/engine/board.c

    RCS file: /sources/gnugo/gnugo/engine/board.c,v
    retrieving revision 1.119
    diff -u -r1.119 board.c
     
    425425   
    426426  memset(board, EMPTY, sizeof(board)); 
    427427  memset(initial_board, EMPTY, sizeof(initial_board)); 
    428   for (k = 0; k < BOARDSIZE; k++) { 
     428  for (k = 0; k < BOARDSIZE; ++k) { 
    429429    if (!ON_BOARD2(I(k), J(k))) { 
    430430      board[k] = GRAY; 
    431431      initial_board[k] = GRAY; 
    432432    } 
    433433  } 
    434434 
     435  board_nextrow = MAX_BOARD - board_size + 2; 
     436 
    435437  board_ko_pos = NO_MOVE; 
    436438  white_captured = 0; 
    437439  black_captured = 0; 
     
    448450 
    449451  handicap = 0; 
    450452   
    451   hashdata_recalc(&board_hash, board, board_ko_pos); 
     453  hashdata_recalc(&board_hash, board, NO_MOVE); 
    452454  new_position(); 
    453455} 
    454456 
     
    10261028/* Return the last move done by anyone. Both if no move was found or 
    10271029 * if the last move was a pass, PASS_MOVE is returned. 
    10281030 */ 
    1029 int 
     1031inline int 
    10301032get_last_move() 
    10311033{ 
    10321034  if (move_history_pointer == 0) 
     
    31493151    int pos; 
    31503152    white_stones = 0; 
    31513153    black_stones = 0; 
    3152     for (pos = BOARDMIN; pos < BOARDMAX; pos++) { 
     3154    scan_board(pos, 
    31533155      if (board[pos] == WHITE) 
    31543156        white_stones++; 
    31553157      else if (board[pos] == BLACK) 
    31563158        black_stones++; 
    3157     } 
     3159        ) 
    31583160     
    31593161    stone_count_for_position = position_number; 
    31603162  } 
     
    32063208  int pos; 
    32073209  int s; 
    32083210 
    3209   position_number++; 
     3211  ++position_number; 
    32103212  next_string = 0; 
    32113213  liberty_mark = 0; 
    32123214  string_mark = 0; 
     
    32213223  /* propagate_string relies on non-assigned stones to have 
    32223224   * string_number -1. 
    32233225   */ 
    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  ) 
    32273229 
    32283230  /* Find the existing strings. */ 
    3229   for (pos = BOARDMIN; pos < BOARDMAX; pos++) { 
    3230     if (!ON_BOARD(pos)) 
    3231       continue; 
     3231  scan_board(pos, 
    32323232    if (IS_STONE(board[pos]) && string_number[pos] == -1) { 
    32333233      string_number[pos] = next_string; 
    32343234      string[next_string].size = propagate_string(pos, pos); 
    32353235      string[next_string].color = board[pos]; 
    32363236      string[next_string].origin = pos; 
    32373237      string[next_string].mark = 0; 
    3238       next_string++; 
     3238      ++next_string; 
    32393239      PARANOID1(next_string < MAX_STRINGS, pos); 
    32403240    } 
    3241   } 
     3241  ) 
    32423242   
    32433243  /* Fill in liberty and neighbor info. */ 
    3244   for (s = 0; s < next_string; s++) { 
     3244  for (s = 0; s < next_string; ++s) { 
    32453245    find_liberties_and_neighbors(s); 
    32463246  } 
    32473247} 
     
    32603260  int s; 
    32613261  int i; 
    32623262   
    3263   for (pos = BOARDMIN; pos < BOARDMAX; pos++) { 
    3264     if (!ON_BOARD(pos)) 
    3265       continue; 
     3263  scan_board(pos, 
    32663264    if (board[pos] == EMPTY) 
    32673265      fprintf(stderr, " . "); 
    32683266    else 
    32693267      fprintf(stderr, "%2d ", string_number[pos]); 
    32703268    fprintf(stderr, "\n"); 
    3271   } 
     3269  ) 
    32723270 
    32733271  for (s = 0; s < next_string; s++) { 
    32743272    if (board[string[s].origin] == EMPTY)