Ticket #145: semeai.c.patch

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

    RCS file: /sources/gnugo/gnugo/engine/semeai.c,v
    retrieving revision 1.79
    diff -u -r1.79 semeai.c
     
    244244  int defend_move; 
    245245  int resulta, resultb; 
    246246   
    247   for (str = BOARDMIN; str < BOARDMAX; str++) { 
     247  scan_board(str, 
    248248    if (IS_STONE(board[str]) && is_worm_origin(str, str) 
    249249        && attack_and_defend(str, NULL, NULL, NULL, &defend_move) 
    250250        && dragon[str].status == DEAD 
     
    338338        dragon2[d].semeai_attack_target = opponent; 
    339339      } 
    340340    } 
    341   } 
     341  ) 
    342342 
    343343  /* Now look for dead strings inside a single eyespace of a living dragon. 
    344344   * 
     
    347347   *        moves invading a previously empty single eyespace to make 
    348348   *        seki can be found. 
    349349   */ 
    350   for (str = BOARDMIN; str < BOARDMAX; str++) { 
     350  scan_board(str, 
    351351    if (IS_STONE(board[str]) && is_worm_origin(str, str) 
    352352        && !find_defense(str, NULL) 
    353353        && dragon[str].status == DEAD 
     
    441441        dragon2[d].semeai_attack_target = opponent; 
    442442      } 
    443443    } 
    444   } 
     444  ) 
    445445} 
    446446 
    447447 
     
    469469close_enough_for_proper_semeai(int apos, int bpos) 
    470470{ 
    471471  int pos; 
    472   for (pos = BOARDMIN; pos < BOARDMAX; pos++) { 
     472  scan_board(pos, 
    473473    if (board[pos] == EMPTY 
    474474        && neighbor_of_dragon(pos, apos) 
    475475        && neighbor_of_dragon(pos, bpos)) 
     
    480480      if (is_same_dragon(pos, bpos) && neighbor_of_dragon(pos, apos)) 
    481481        return 1; 
    482482    } 
    483   } 
     483  ) 
    484484   
    485485  return 0; 
    486486} 
     
    579579    DEBUG(DEBUG_SEMEAI, "Changing status of %1m from %s to %s.\n", dr, 
    580580          status_to_string(dragon[dr].status), 
    581581          status_to_string(new_status)); 
    582     for (pos = BOARDMIN; pos < BOARDMAX; pos++) 
     582    scan_board(pos, 
    583583      if (IS_STONE(board[pos]) && is_same_dragon(dr, pos)) { 
    584584        dragon[pos].status = new_status; 
    585585        if (new_status != DEAD) 
    586586          worm[pos].inessential = 0; 
    587       } 
     587          } 
     588        ) 
    588589  } 
    589590 
    590591  if (DRAGON2(dr).safety != new_safety