Ticket #145: play_gtp.c.patch

File play_gtp.c.patch, 2.1 kB (added by draqo, 2 years ago)
  • gnugo/interface/play_gtp.c

    RCS file: /sources/gnugo/gnugo/interface/play_gtp.c,v
    retrieving revision 1.183
    diff -u -r1.183 play_gtp.c
     
    22192219   
    22202220  gtp_start_response(GTP_SUCCESS); 
    22212221 
    2222   for (pos = BOARDMIN; pos < BOARDMAX; pos++) { 
    2223     if (ON_BOARD(pos) 
    2224         && (pos == str 
     2222  scan_board(pos, 
     2223    if (pos == str 
    22252224            || (str == NO_MOVE 
    22262225                && board[pos] != EMPTY 
    2227                 && dragon[pos].origin == pos))) { 
     2226                && dragon[pos].origin == pos)) { 
    22282227      if (str == NO_MOVE) 
    22292228        gtp_mprintf("%m: ", I(pos), J(pos)); 
    22302229       
     
    22462245      } 
    22472246      empty_response = 0; 
    22482247    } 
    2249   } 
     2248  ) 
    22502249 
    22512250  if (empty_response) 
    22522251    gtp_printf("\n"); 
     
    23762375    return gtp_success("PASS"); 
    23772376   
    23782377  gtp_start_response(GTP_SUCCESS); 
    2379   for (pos = BOARDMIN; pos < BOARDMAX; pos++) 
    2380     if (ON_BOARD(pos) && defense_points[pos]) { 
     2378  scan_board(pos, 
     2379    if (defense_points[pos]) { 
    23812380      if (!first) 
    23822381        gtp_printf(" "); 
    23832382      else 
    23842383        first = 0; 
    23852384      gtp_print_vertex(I(pos), J(pos)); 
    2386     } 
     2385        } 
     2386  ) 
    23872387   
    23882388  return gtp_finish_response(); 
    23892389} 
     
    36963696  compute_move_probabilities(probabilities); 
    36973697 
    36983698  gtp_start_response(GTP_SUCCESS); 
    3699   for (pos = BOARDMIN; pos < BOARDMAX; pos++) { 
    3700     if (ON_BOARD(pos) && probabilities[pos] != 0.0) { 
     3699  scan_board(pos, 
     3700    if (probabilities[pos] != 0.0) { 
    37013701      gtp_mprintf("%m ", I(pos), J(pos)); 
    37023702      gtp_printf("%.4f\n", probabilities[pos]); 
    37033703      any_moves_printed = 1; 
    37043704    } 
    3705   } 
     3705  ) 
    37063706 
    37073707  if (!any_moves_printed) 
    37083708    gtp_printf("\n"); 
     
    37313731  compute_move_probabilities(probabilities); 
    37323732 
    37333733  gtp_start_response(GTP_SUCCESS); 
    3734   for (pos = BOARDMIN; pos < BOARDMAX; pos++) { 
    3735     if (ON_BOARD(pos) && probabilities[pos] > 0.0) { 
     3734  scan_board(pos, 
     3735    if (probabilities[pos] > 0.0) { 
    37363736      /* Shannon's formula */ 
    37373737      uncertainty += -1 * ((double)probabilities[pos]) * 
    37383738        log((double)probabilities[pos]) / log(2.0); 
    37393739    } 
    3740   } 
     3740  ) 
    37413741 
    37423742  gtp_printf("%.4f\n\n", uncertainty); 
    37433743