Ticket #1: splee_5_5.1c.diff

File splee_5_5.1c.diff, 3.3 kB (added by gunnar, 4 years ago)

The patch splee_5_5.1c

  • engine/reading.c

    RCS file: /cvsroot/gnugo/gnugo/engine/reading.c,v
    retrieving revision 1.152
    diff -u -r1.152 reading.c
     
    309309                        int color, const char *funcname, int killer); 
    310310static int simple_ladder_defend(int str, int *move); 
    311311static int in_list(int move, int num_moves, int *moves); 
     312static int is_single(int pos, int color); 
    312313 
    313314 
    314315/* Statistics. */ 
     
    46144615    moves->score[k] = -2; 
    46154616} 
    46164617 
     4618static int 
     4619is_single(int pos, int color) 
     4620{ 
     4621  if ((board[SOUTH(pos)] != color) && (board[EAST(pos)] != color) && 
     4622      (board[WEST(pos)] != color) && (board[NORTH(pos)] != color)) 
     4623    return(1); 
     4624  return(0); 
     4625} 
    46174626 
    46184627/* 
    46194628 * (str) points to a group. 
     
    46544663 
    46554664    /* If the 3 liberty chain easily can run away through one of the 
    46564665     * liberties, we don't play on any of the other liberties. 
     4666     * The heuristic for "easily run away" is defined as: 
     4667     * 1. Playing on any of the 3 liberties of the chain and the resulting 
     4668     *    number of liberty of the chain will be less than 4. Or 
     4669     * 2. Playing on the 3 liberties in turn will resulting in: 
     4670     *    4 or more liberties, 4 or less liberties and less than 
     4671     *    4 liberties. In this case we only try one breaking chain move 
     4672     *    on the position with escape potential of 4 or more liberties. 
    46574673     */ 
    46584674    lib1 = approxlib(libs[0], other, 4, NULL); 
    46594675    lib2 = approxlib(libs[1], other, 4, NULL); 
    4660     if (lib1 >= 4 && lib2 >= 4) 
    4661       continue; 
    46624676    lib3 = approxlib(libs[2], other, 4, NULL); 
    46634677 
    4664     if ((lib1 >= 4 || lib2 >= 4) && lib3 >= 4) 
    4665       continue; 
    4666  
    46674678    if (lib1 >= 4 && !mw[libs[0]]) { 
    4668       mw[libs[0]] = 1; 
    4669       possible_moves[u++] = libs[0]; 
     4679      if ((lib2 <= 4 && lib3 < 4) || (lib3 <= 4 && lib2 <4)) 
     4680      { 
     4681       /* For the safety of the breaking chain move, 
     4682        * the move must be either a single stone, or a resulting 
     4683        * string of 4 or more liberties 
     4684        */ 
     4685        if (is_single(libs[0], color) || approxlib(libs[0], color, 4, NULL) > 3) 
     4686        { 
     4687          mw[libs[0]] = 1; 
     4688          possible_moves[u++] = libs[0]; 
     4689        } 
     4690      } 
    46704691      continue; 
    46714692    } 
    46724693     
    46734694    if (lib2 >= 4 && !mw[libs[1]]) { 
    4674       mw[libs[1]] = 1; 
    4675       possible_moves[u++] = libs[1]; 
     4695      if ((lib1 <= 4 && lib3 < 4) || (lib3 <= 4 && lib1 <4)) 
     4696      { 
     4697        if (is_single(libs[1], color) || approxlib(libs[1], color, 4, NULL) > 3) 
     4698        { 
     4699          mw[libs[1]] = 1; 
     4700          possible_moves[u++] = libs[1]; 
     4701        } 
     4702      } 
    46764703      continue; 
    46774704    } 
    46784705     
    46794706    if (lib3 >= 4 && !mw[libs[2]]) { 
    4680       mw[libs[2]] = 1; 
    4681       possible_moves[u++] = libs[2]; 
     4707      if ((lib2 <= 4 && lib1 < 4) || (lib1 <= 4 && lib2 <4)) 
     4708      { 
     4709        if (is_single(libs[2], color) || approxlib(libs[2], color, 4, NULL) > 3) 
     4710        { 
     4711          mw[libs[2]] = 1; 
     4712          possible_moves[u++] = libs[2]; 
     4713        } 
     4714      } 
    46824715      continue; 
    46834716    } 
    46844717 
     4718    if (lib1 >= 4 || lib2 >= 4 || lib3 >= 4) 
     4719      continue; 
     4720 
    46854721    /* No easy escape, try all liberties. */ 
    46864722    for (k = 0; k < 3; k++) { 
    46874723      if (!mw[libs[k]]) {