Ticket #145: dragon.c.patch

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

    RCS file: /sources/gnugo/gnugo/engine/dragon.c,v
    retrieving revision 1.162
    diff -u -r1.162 dragon.c
     
    144144    compute_dragon_genus(dragon2[d].origin, &dragon2[d].genus, NO_MOVE); 
    145145 
    146146  /* Compute the escape route measure. */ 
    147   for (str = BOARDMIN; str < BOARDMAX; str++) 
     147  scan_board(str, 
    148148    if (IS_STONE(board[str]) && dragon[str].origin == str) 
    149149      DRAGON2(str).escape_route = compute_escape(str, 0); 
     150  ) 
    150151 
    151152  /* Set dragon weaknesses according to initial_influence. */ 
    152153  compute_refined_dragon_weaknesses(); 
     
    154155    dragon2[d].weakness_pre_owl = dragon2[d].weakness; 
    155156 
    156157  /* Determine status: ALIVE, DEAD, CRITICAL or UNKNOWN */ 
    157   for (str = BOARDMIN; str < BOARDMAX; str++) 
    158     if (ON_BOARD(str)) 
    159       if (dragon[str].origin == str && board[str]) 
    160         dragon[str].crude_status = compute_crude_status(str); 
     158  scan_board(str, 
     159    if (dragon[str].origin == str && board[str]) 
     160          dragon[str].crude_status = compute_crude_status(str); 
     161  ) 
    161162   
    162163  /* We must update the dragon status at every intersection before we 
    163164   * call the owl code. This updates all fields. 
    164165   */ 
    165   for (str = BOARDMIN; str < BOARDMAX; str++) 
    166     if (ON_BOARD(str) && board[str] != EMPTY) 
     166  scan_board(str, 
     167    if (board[str] != EMPTY) 
    167168      dragon[str] = dragon[dragon[str].origin]; 
     169  ) 
    168170   
    169171  find_neighbor_dragons(); 
    170172 
     
    191193   * if necessary. 
    192194   */ 
    193195  start_timer(2); 
    194   for (str = BOARDMIN; str < BOARDMAX; str++) 
    195     if (ON_BOARD(str)) { 
     196  scan_board(str, 
    196197      int attack_point = NO_MOVE; 
    197198      int defense_point = NO_MOVE; 
    198199      struct eyevalue no_eyes; 
     
    287288           
    288289        } 
    289290      } 
    290     } 
     291  ) 
    291292  time_report(2, "  owl reading", NO_MOVE, 1.0); 
    292293   
    293294  /* Compute the status to be used by the matcher. We most trust the 
     
    295296   * already confident that the dragon is alive, regardless of 
    296297   * crude_status. 
    297298   */ 
    298   for (str = BOARDMIN; str < BOARDMAX; str++) 
     299  scan_board(str, 
    299300    if (IS_STONE(board[str])) { 
    300301      if (DRAGON2(str).owl_status != UNCHECKED) 
    301302        dragon[str].status = DRAGON2(str).owl_status; 
    302303      else 
    303304        dragon[str].status = ALIVE; 
    304305    } 
     306  ) 
    305307 
    306308  /* The dragon data is now correct at the origin of each dragon but 
    307309   * we need to copy it to every vertex.   
    308310   */ 
    309   for (str = BOARDMIN; str < BOARDMAX; str++) 
    310     if (ON_BOARD(str) && board[str] != EMPTY) 
     311  scan_board(str, 
     312    if (board[str] != EMPTY) 
    311313      dragon[str] = dragon[dragon[str].origin]; 
     314  ) 
    312315 
    313316  identify_thrashing_dragons(); 
    314317   
    315318  /* Owl threats. */ 
    316   for (str = BOARDMIN; str < BOARDMAX; str++) 
    317     if (ON_BOARD(str)  
    318         && board[str] != EMPTY  
     319  scan_board(str, 
     320    if (board[str] != EMPTY  
    319321        && dragon[str].origin == str) { 
    320322      struct eyevalue no_eyes; 
    321323      set_eyevalue(&no_eyes, 0, 0, 0, 0); 
     
    330332      else { 
    331333        int acode = DRAGON2(str).owl_attack_code; 
    332334        int dcode = DRAGON2(str).owl_defense_code; 
    333         int defense_point, second_defense_point; 
     335        int defense_point; 
     336        int second_defense_point; 
    334337 
    335338        if (get_level() >= 8 
    336339            && !disable_threat_computation 
     
    347350              DRAGON2(str).owl_threat_status = DEAD; 
    348351          } 
    349352          else if (!acode) { 
    350             int attack_point, second_attack_point; 
     353            int attack_point; 
     354                int second_attack_point; 
    351355            if (owl_threaten_attack(str,  
    352356                                    &attack_point, &second_attack_point)) { 
    353357              DRAGON2(str).owl_threat_status = CAN_THREATEN_ATTACK; 
     
    359363          } 
    360364        } 
    361365      } 
    362     } 
     366        } 
     367  ) 
    363368   
    364369  /* Once again, the dragon data is now correct at the origin of each dragon 
    365370   * but we need to copy it to every vertex.   
    366371   */ 
    367   for (str = BOARDMIN; str < BOARDMAX; str++) 
    368     if (ON_BOARD(str) && board[str] != EMPTY) 
     372  scan_board(str, 
     373    if (board[str] != EMPTY) 
    369374      dragon[str] = dragon[dragon[str].origin]; 
     375  ) 
    370376 
    371377  time_report(2, "  owl threats ", NO_MOVE, 1.0); 
    372378   
     
    410416  /* The status is now correct at the origin of each dragon 
    411417   * but we need to copy it to every vertex. 
    412418   */ 
    413   for (str = BOARDMIN; str < BOARDMAX; str++) 
    414     if (ON_BOARD(str)) 
    415       dragon[str].status = dragon[dragon[str].origin].status; 
     419  scan_board(str, 
     420    dragon[str].status = dragon[dragon[str].origin].status; 
     421  ) 
    416422 
    417423  /* Revise inessentiality of critical worms and dragons. */ 
    418424  revise_inessentiality(); 
     
    438444find_lunches() 
    439445{ 
    440446  int str; 
    441   for (str = BOARDMIN; str < BOARDMAX; str++) 
    442     if (ON_BOARD(str)) { 
     447  scan_board(str, 
    443448      int food; 
    444449 
    445450      if (worm[str].origin != str 
     
    475480                worm[food].origin, worm[food].cutstone); 
    476481        } 
    477482      } 
    478     } 
     483  ) 
    479484} 
    480485 
    481486 
     
    488493{  
    489494  int str; 
    490495 
    491   for (str = BOARDMIN; str < BOARDMAX; str++) { 
    492     if (!ON_BOARD(str)) 
    493       continue; 
    494  
     496  scan_board(str, 
    495497    if (black_eye[str].color == BLACK 
    496498        && black_eye[str].origin == str) { 
    497499      struct eyevalue value; 
    498       int attack_point, defense_point; 
     500      int attack_point; 
     501          int defense_point; 
    499502       
    500503      compute_eyes(str, &value, &attack_point, &defense_point,  
    501504                   black_eye, half_eye, 1); 
     
    508511    if (white_eye[str].color == WHITE 
    509512        && white_eye[str].origin == str) { 
    510513      struct eyevalue value; 
    511       int attack_point, defense_point; 
     514      int attack_point; 
     515          int defense_point; 
    512516       
    513517      compute_eyes(str, &value, &attack_point, &defense_point, 
    514518                   white_eye, half_eye, 1); 
     
    517521      white_eye[str].value = value; 
    518522      propagate_eye(str, white_eye); 
    519523    } 
    520   } 
     524  ) 
    521525} 
    522526 
    523527 
     
    570574   * not dead, is considered inessential. 
    571575   */ 
    572576 
    573   for (str = BOARDMIN; str < BOARDMAX; str++) 
    574     if (ON_BOARD(str)) { 
     577  scan_board(str, 
    575578      if (is_worm_origin(str, str) 
    576579          && worm[str].attack_codes[0] != 0 
    577580          && worm[str].defense_codes[0] != 0 
     
    594597          propagate_worm(str); 
    595598        } 
    596599      } 
    597     } 
     600  ) 
    598601 
    599602  /* Revise essentiality of critical dragons. Specifically, a critical 
    600603   * dragon consisting entirely of inessential worms is considered 
    601604   * INESSENTIAL. 
    602605   */ 
    603   for (str = BOARDMIN; str < BOARDMAX; str++) { 
    604     if (ON_BOARD(str) 
    605         && board[str] != EMPTY 
     606  scan_board(str, 
     607    if (board[str] != EMPTY 
    606608        && dragon[str].origin == str 
    607609        && DRAGON2(str).safety == CRITICAL) { 
    608610      int w; 
     
    617619        DRAGON2(str).safety = INESSENTIAL; 
    618620      } 
    619621    } 
    620   } 
     622  ) 
    621623} 
    622624 
    623625/* Initialize the dragon[] array. */ 
     
    627629{ 
    628630  int str; 
    629631  /* VALGRIND_MAKE_WRITABLE(dragon, BOARDMAX * sizeof(struct dragon_data)); */ 
    630   for (str = BOARDMIN; str < BOARDMAX; str++) 
    631     if (ON_BOARD(str)) { 
    632  
     632  scan_board(str, 
    633633      dragon[str].id                 = -1; 
    634634      dragon[str].size               = worm[str].size; 
    635635      dragon[str].effective_size     = worm[str].effective_size; 
     
    644644        DEBUG(DEBUG_DRAGONS,  
    645645              "Initializing dragon from worm at %1m, size %d\n",  
    646646              str, worm[str].size); 
    647     } 
     647  ) 
    648648  memset(next_worm_list, 0, sizeof(next_worm_list)); 
    649649 
    650650  /* We need to reset this to avoid trouble on an empty board when 
     
    673673   * the dragon2 array. After this the DRAGON2 macro can be used. 
    674674   */ 
    675675  number_of_dragons = 0; 
    676   for (str = BOARDMIN; str < BOARDMAX; str++) { 
    677     if (!ON_BOARD(str)) 
    678       continue; 
     676  scan_board(str, 
    679677    origin = dragon[str].origin; 
    680678     
    681679    if (board[str] == EMPTY) 
     
    684682    if (dragon[origin].id == -1) 
    685683      dragon[origin].id = number_of_dragons++; 
    686684    dragon[str].id = dragon[origin].id; 
    687   } 
     685  ) 
    688686   
    689687  /* Now number_of_dragons contains the number of dragons and we can 
    690688   * allocate a dragon2 array of the appropriate size. First throw 
     
    702700  /* Find the origins of the dragons to establish the mapping back to 
    703701   * the board. After this the DRAGON macro can be used. 
    704702   */ 
    705   for (str = BOARDMIN; str < BOARDMAX; str++) { 
    706     if (!ON_BOARD(str)) 
    707       continue; 
     703  scan_board(str, 
    708704    if (IS_STONE(board[str]) 
    709705        && dragon[str].origin == str) { 
    710706      DRAGON2(str).origin = str; 
    711707    } 
    712   } 
     708  ) 
    713709   
    714710  /* Initialize the rest of the dragon2 data. */ 
    715711  for (d = 0; d < number_of_dragons; d++) { 
     
    772768  gg_assert(dragon2_initialized); 
    773769   
    774770  /* Initialize the arrays. */ 
    775   for (pos = BOARDMIN; pos < BOARDMAX; pos++) { 
     771  scan_board(pos, 
    776772    if (IS_STONE(board[pos])) { 
    777773      dragons[pos] = dragon[pos].id; 
    778774      distances[pos] = 0; 
    779775    } 
    780     else if (ON_BOARD(pos)) { 
     776    else { 
    781777      dragons[pos] = -1; 
    782778      distances[pos] = -1; 
    783779    } 
    784   } 
     780  ) 
    785781 
    786782  /* Expand from dist-1 to dist. Break out of the loop at the end if 
    787783   * we couldn't expand anything. Never expand more than five steps. 
     
    789785  for (dist = 1; dist <= 5; dist++) { 
    790786    int found_one = 0; 
    791787       
    792     for (pos = BOARDMIN; pos < BOARDMAX; pos++) { 
    793       if (!ON_BOARD(pos)) 
    794         continue; 
     788    scan_board(pos, 
    795789     
    796790      if (distances[pos] != dist-1 || dragons[pos] < 0) 
    797791        continue; 
     
    829823          } 
    830824        } 
    831825      } 
    832     } 
     826        ) 
    833827    if (!found_one) 
    834828      break; 
    835829  } 
     
    855849   * where dragons==-2 we set all the neighbors of this intersection 
    856850   * as adjacent to each other. 
    857851   */ 
    858   for (pos = BOARDMIN; pos < BOARDMAX; pos++) { 
    859     if (!ON_BOARD(pos)) 
    860       continue; 
     852  scan_board(pos, 
    861853    if (dragons[pos] == -2) { 
    862854      int neighbors = 0; 
    863855      int adjacent[4]; 
     
    884876          add_adjacent_dragons(dragons[pos], dragons[EAST(pos)]); 
    885877      } 
    886878    } 
    887   } 
     879  ) 
    888880   
    889881  if (0) { 
    890882    for (d = 0; d < number_of_dragons; d++) { 
     
    957949  ASSERT1(IS_STONE(board[dr]), dr); 
    958950 
    959951  /* First look for invincible strings in the dragon. */ 
    960   for (pos = BOARDMIN; pos < BOARDMAX; pos++) { 
    961     if (ON_BOARD(pos) && is_same_dragon(pos, dr) && worm[pos].invincible) 
     952  scan_board(pos, 
     953    if (is_same_dragon(pos, dr) && worm[pos].invincible) 
    962954      return 1; 
    963   } 
     955  ) 
    964956 
    965957  /* Can the dragon be owl attacked? */ 
    966958  if (DRAGON2(dr).owl_status != UNCHECKED && DRAGON2(dr).owl_status != ALIVE) 
     
    978970 
    979971  memset(mx, 0, sizeof(mx)); 
    980972 
    981   for (pos = BOARDMIN; pos < BOARDMAX; pos++) { 
     973  scan_board(pos, 
    982974    if (board[pos] == board[dr] && is_same_dragon(pos, dr)) { 
    983975      for (k = 0; k < 4; k++) { 
    984976        int pos2 = pos + delta[k]; 
     
    997989        } 
    998990      } 
    999991    } 
    1000   } 
     992  ) 
    1001993 
    1002   for (pos = BOARDMIN; pos < BOARDMAX; pos++) { 
     994  scan_board(pos, 
    1003995    /* Necessary to check eye margins here since the loop above only 
    1004996     * considers margins which are directly adjacent to some stone of 
    1005997     * the dragon. 
     
    1007999    if (mx[pos] == 1 
    10081000        && eye[pos].msize == 0) 
    10091001      strong_eyes++; 
    1010   } 
     1002  ) 
    10111003 
    10121004  if (strong_eyes >= 2) 
    10131005    return 1; 
     
    11171109   
    11181110  for (dist = 1; dist < 5; dist++) { 
    11191111    int pos; 
    1120     for (pos = BOARDMIN; pos < BOARDMAX; pos++) { 
     1112    scan_board(pos, 
    11211113      if (board[pos] != color 
    11221114          || dragon[pos].origin != pos 
    11231115          || thrashing_stone[pos] != dist) 
     
    11351127                      (signed char)(dist + 1)); 
    11361128        } 
    11371129      } 
    1138     } 
     1130        ) 
    11391131  } 
    11401132} 
    11411133 
     
    11441136set_dragon_strengths(const signed char safe_stones[BOARDMAX], 
    11451137                     float strength[BOARDMAX]) 
    11461138{ 
    1147   int ii; 
    1148   for (ii = BOARDMIN; ii < BOARDMAX; ii++) 
    1149     if (ON_BOARD(ii)) { 
    1150       if (safe_stones[ii]) { 
    1151         ASSERT1(IS_STONE(board[ii]), ii); 
    1152         strength[ii] = DEFAULT_STRENGTH 
    1153                        * (1.0 - 0.3 * DRAGON2(ii).weakness_pre_owl); 
    1154       } 
     1139  int pos; 
     1140  scan_board(pos, 
     1141      if (safe_stones[pos]) { 
     1142        ASSERT1(IS_STONE(board[pos]), pos); 
     1143        strength[pos] = DEFAULT_STRENGTH 
     1144                       * (1.0 - 0.3 * DRAGON2(pos).weakness_pre_owl); 
     1145          } 
    11551146      else 
    1156         strength[ii] = 0.0; 
    1157     } 
     1147        strength[pos] = 0.0; 
     1148  ) 
    11581149} 
    11591150 
    11601151/* Marks all inessential stones with INFLUENCE_SAFE_STONE, leaves 
     
    11631154void 
    11641155mark_inessential_stones(int color, signed char safe_stones[BOARDMAX]) 
    11651156{ 
    1166   int ii; 
    1167   for (ii = BOARDMIN; ii < BOARDMAX; ii++) 
    1168     if (IS_STONE(board[ii]) 
    1169         && (DRAGON2(ii).safety == INESSENTIAL 
    1170             || (worm[ii].inessential 
     1157  int pos; 
     1158  scan_board(pos, 
     1159    if (IS_STONE(board[pos]) 
     1160        && (DRAGON2(pos).safety == INESSENTIAL 
     1161            || (worm[pos].inessential 
    11711162                /* FIXME: Why is the check below needed? 
    11721163                 * Why does it use .safety, not .status? /ab 
    11731164                 */ 
    1174                 && ((DRAGON2(ii).safety != DEAD 
    1175                      && DRAGON2(ii).safety != TACTICALLY_DEAD 
    1176                      && DRAGON2(ii).safety != CRITICAL) 
    1177                     || (DRAGON2(ii).safety == CRITICAL 
    1178                         && board[ii] == color))))) 
    1179       safe_stones[ii] = INFLUENCE_SAFE_STONE; 
     1165                && ((DRAGON2(pos).safety != DEAD 
     1166                     && DRAGON2(pos).safety != TACTICALLY_DEAD 
     1167                     && DRAGON2(pos).safety != CRITICAL) 
     1168                    || (DRAGON2(pos).safety == CRITICAL 
     1169                        && board[pos] == color))))) 
     1170      safe_stones[pos] = INFLUENCE_SAFE_STONE; 
     1171  ) 
    11801172} 
    11811173 
    11821174void 
     
    12241216  set_eyevalue(genus, 0, 0, 0, 0); 
    12251217 
    12261218  if (board[d] == BLACK) { 
    1227     for (pos = BOARDMIN; pos < BOARDMAX; pos++) { 
    1228       if (!ON_BOARD(pos)) 
    1229         continue; 
     1219    scan_board(pos, 
    12301220 
    12311221      if (black_eye[pos].color == BLACK 
    12321222          && black_eye[pos].origin == pos 
     
    12441234 
    12451235        add_eyevalues(genus, &black_eye[pos].value, genus); 
    12461236      } 
    1247     } 
     1237        ) 
    12481238  } 
    12491239  else { 
    1250     for (pos = BOARDMIN; pos < BOARDMAX; pos++) { 
    1251       if (!ON_BOARD(pos)) 
    1252         continue; 
     1240    scan_board(pos, 
    12531241 
    12541242      if (white_eye[pos].color == WHITE 
    12551243          && white_eye[pos].origin == pos 
     
    12671255 
    12681256        add_eyevalues(genus, &white_eye[pos].value, genus); 
    12691257      } 
    1270     } 
     1258        ) 
    12711259  } 
    12721260} 
    12731261 
     
    13071295  struct eye_data *eye; 
    13081296  int k; 
    13091297 
    1310   for (pos = BOARDMIN; pos < BOARDMAX; pos++) { 
    1311     if (!ON_BOARD(pos)) 
    1312       continue; 
    1313      
     1298  scan_board(pos, 
    13141299    false_eye_territory[pos] = 0; 
    13151300 
    13161301    /* The analysis only applies to false and half eyes. */ 
     
    13631348      if (0) 
    13641349        gprintf("False eye territory at %1m\n", pos); 
    13651350    } 
    1366   } 
     1351  ) 
    13671352 
    13681353  /* FIXME: This initialization doesn't really belong here but must be 
    13691354   *        done somewhere within examine_position(). 
    13701355   *        The array is eventually filled by the endgame() function. 
    13711356   */ 
    1372   for (pos = BOARDMIN; pos < BOARDMAX; pos++) 
    1373     if (ON_BOARD(pos)) 
    1374       forced_backfilling_moves[pos] = 0; 
     1357  scan_board(pos, 
     1358    forced_backfilling_moves[pos] = 0; 
     1359  ) 
    13751360} 
    13761361 
    13771362/*  
     
    14731458  int pos; 
    14741459  int k; 
    14751460 
    1476   for (pos = BOARDMIN; pos < BOARDMAX; pos++) { 
     1461  scan_board(pos, 
    14771462    struct worm_data *w = &(worm[pos]); 
    14781463    if (!IS_STONE(board[pos])) 
    14791464      continue; 
     
    15391524      if (is_ko_point(pos)) 
    15401525        gprintf("- is a ko stone\n"); 
    15411526    } 
    1542   } 
     1527  ) 
    15431528     
    15441529  gprintf("%o\n"); 
    1545   for (pos = BOARDMIN; pos < BOARDMAX; pos++) { 
     1530  scan_board(pos, 
    15461531    struct dragon_data *dd = &(dragon[pos]); 
    15471532    struct dragon_data2 *d2; 
    15481533     
     
    15921577      if (d2->lunch != NO_MOVE) 
    15931578        gprintf("... adjacent worm %1m is lunch\n", d2->lunch); 
    15941579    } 
    1595   } 
     1580  ) 
    15961581} 
    15971582 
    15981583 
     
    16161601   
    16171602  memcpy(saved_cutting_points, cutting_points, sizeof(cutting_points)); 
    16181603  memset(cutting_points, 0, sizeof(cutting_points)); 
    1619   for (pos = BOARDMIN; pos < BOARDMAX; pos++) 
    1620     if (ON_BOARD(pos)) { 
     1604  scan_board(pos, 
    16211605      if (board[pos] == EMPTY) 
    16221606        new_dragon_origins[pos] = NO_MOVE; 
    16231607      else 
    16241608        new_dragon_origins[pos] = find_origin(pos); 
    1625     } 
     1609  ) 
    16261610   
    16271611  find_cuts(); 
    16281612  find_connections(); 
     
    16511635  ASSERT1(IS_STONE(board[d1]), d1); 
    16521636 
    16531637  /* Don't bother to do anything fancy with dragon origins. */ 
    1654   for (pos = BOARDMIN; pos < BOARDMAX; pos++) 
    1655     if (ON_BOARD(pos) && new_dragon_origins[pos] == d2) 
     1638  scan_board(pos, 
     1639    if (new_dragon_origins[pos] == d2) 
    16561640      new_dragon_origins[pos] = d1; 
     1641  ) 
    16571642} 
    16581643 
    16591644/*  
     
    17171702      next_worm_list[last_worm_origin_dragon] = d1; 
    17181703  } 
    17191704 
    1720   for (ii = BOARDMIN; ii < BOARDMAX; ii++) { 
    1721     if (ON_BOARD(ii) 
    1722         && (dragon[ii].origin == d1 || dragon[ii].origin == d2)) 
     1705  scan_board(ii, 
     1706    if (dragon[ii].origin == d1 || dragon[ii].origin == d2) 
    17231707      dragon[ii].origin = origin; 
    1724   } 
     1708  ) 
    17251709} 
    17261710 
    17271711 
     
    18521836  } 
    18531837 
    18541838  /* Enter the stones of the dragon in the queue. */ 
    1855   for (ii = BOARDMIN; ii < BOARDMAX; ii++) 
    1856     if (ON_BOARD(ii) && goal[ii]) 
     1839  scan_board(ii, 
     1840    if (goal[ii]) 
    18571841      ENQUEUE(ii); 
     1842  ) 
    18581843   
    18591844  /* Find points at increasing distances from the dragon. At distance 
    18601845   * four, sum the escape values at those points to get the escape 
     
    19911976 
    19921977  ASSERT1(IS_STONE(board[pos]), pos); 
    19931978 
    1994   for (ii = BOARDMIN; ii < BOARDMAX; ii++) 
    1995     if (ON_BOARD(ii)) 
    1996       goal[ii] = is_same_dragon(ii, pos); 
     1979  scan_board(ii, 
     1980    goal[ii] = is_same_dragon(ii, pos); 
     1981  ) 
    19971982 
    19981983  /* Compute escape_value array.  Points are awarded for moyo (4), 
    19991984   * area (2) or EMPTY (1).  Values may change without notice. 
     
    20021987  compute_escape_influence(board[pos], safe_stones, NULL, 0, escape_value); 
    20031988 
    20041989  /* If we can reach a live group, award 6 points. */ 
    2005   for (ii = BOARDMIN; ii < BOARDMAX; ii++) { 
    2006     if (!ON_BOARD(ii)) 
    2007       continue; 
     1990  scan_board(ii, 
    20081991 
    20091992    if (dragon_status_known) { 
    20101993      if (dragon[ii].crude_status == ALIVE) 
     
    20202003          && worm[ii].attack_codes[0] == 0) 
    20212004        escape_value[ii] = 2; 
    20222005    } 
    2023   } 
     2006  ) 
    20242007   
    20252008  return dragon_escape(goal, board[pos], escape_value); 
    20262009} 
     
    20512034  float moyo_values[BOARDMAX]; 
    20522035     
    20532036 
    2054   for (pos = BOARDMIN; pos < BOARDMAX; pos++) { 
     2037  scan_board(pos, 
    20552038    moyo_sizes[pos] = 0.0; 
    20562039    moyo_values[pos] = 0.0; 
    2057   } 
     2040  ) 
    20582041   
    2059   for (pos = BOARDMIN; pos < BOARDMAX; pos++) { 
    2060     if (!ON_BOARD(pos)) 
    2061       continue; 
     2042  scan_board(pos, 
    20622043    moyo_color = whose_moyo_restricted(q, pos); 
    20632044     
    20642045    if (moyo_color == board[pos])