Ticket #1: splee_5_5.1d.diff

File splee_5_5.1d.diff, 3.3 kB (added by arend, 3 years ago)

This is splee_5_5.1c rediffed to 3.7.8, with is_single ()removed (it is equivalent to !has_neighbor())

  • engine/reading.c

    RCS file: /home/arend/Go/gnugo-rsync/gnugo/engine/reading.c,v
    retrieving revision 1.168
    diff -u -p -r1.168 reading.c
     
    299299                        int color, const char *funcname, int killer); 
    300300static int simple_ladder_defend(int str, int *move); 
    301301static int in_list(int move, int num_moves, int *moves); 
     302static int is_single(int pos, int color); 
    302303 
    303304 
    304305/* Statistics. */ 
     
    44674468 
    44684469    /* If the 3 liberty chain easily can run away through one of the 
    44694470     * liberties, we don't play on any of the other liberties. 
     4471     * The heuristic for "easily run away" is defined as: 
     4472     * 1. Playing on any of the 3 liberties of the chain and the resulting 
     4473     *    number of liberty of the chain will be less than 4. Or 
     4474     * 2. Playing on the 3 liberties in turn will resulting in: 
     4475     *    4 or more liberties, 4 or less liberties and less than 
     4476     *    4 liberties. In this case we only try one breaking chain move 
     4477     *    on the position with escape potential of 4 or more liberties. 
    44704478     */ 
    44714479    lib1 = approxlib(libs[0], other, 4, NULL); 
    44724480    lib2 = approxlib(libs[1], other, 4, NULL); 
    4473     if (lib1 >= 4 && lib2 >= 4) 
    4474       continue; 
    44754481    lib3 = approxlib(libs[2], other, 4, NULL); 
    44764482 
    4477     if ((lib1 >= 4 || lib2 >= 4) && lib3 >= 4) 
    4478       continue; 
    4479  
    44804483    if (lib1 >= 4) { 
    4481       if (!move_added[libs[0]]) { 
     4484      /* For the safety of the breaking chain move, 
     4485       * the move must be either a single stone, or a resulting 
     4486       * string of 4 or more liberties 
     4487       */ 
     4488      if (((lib2 <= 4 && lib3 < 4) 
     4489            || (lib3 <= 4 && lib2 < 4)) 
     4490          && ((is_single(libs[0], color) 
     4491              || approxlib(libs[0], color, 4, NULL) > 3)) 
     4492          && !move_added[libs[0]]) { 
    44824493        possible_moves[num_possible_moves++] = libs[0]; 
    44834494        move_added[libs[0]] = 1; 
    44844495      } 
    4485  
    44864496      continue; 
    44874497    } 
    44884498 
    44894499    if (lib2 >= 4) { 
    4490       if (!move_added[libs[1]]) { 
     4500      if (((lib1 <= 4 && lib3 < 4) 
     4501            || (lib3 <= 4 && lib1 < 4)) 
     4502          && (is_single(libs[1], color) 
     4503              || approxlib(libs[1], color, 4, NULL) > 3) 
     4504          && !move_added[libs[1]]) { 
    44914505        possible_moves[num_possible_moves++] = libs[1]; 
    44924506        move_added[libs[1]] = 1; 
    44934507      } 
    4494  
    44954508      continue; 
    44964509    } 
    44974510 
    44984511    if (lib3 >= 4) { 
    4499       if (!move_added[libs[2]]) { 
     4512      if (((lib2 <= 4 && lib1 < 4) 
     4513            || (lib1 <= 4 && lib2 < 4)) 
     4514          && (is_single(libs[2], color) 
     4515              || approxlib(libs[2], color, 4, NULL) > 3) 
     4516          && !move_added[libs[2]]) { 
    45004517        possible_moves[num_possible_moves++] = libs[2]; 
    45014518        move_added[libs[2]] = 1; 
    45024519      } 
     
    45044521      continue; 
    45054522    } 
    45064523 
     4524    if (lib1 >= 4 || lib2 >= 4 || lib3 >= 4) 
     4525      continue; 
     4526 
    45074527    /* No easy escape, try all liberties. */ 
    45084528    for (k = 0; k < 3; k++) { 
    45094529      if (!move_added[libs[k]]) { 
     
    45574577  } 
    45584578} 
    45594579 
     4580static int 
     4581is_single(int pos, int color) 
     4582{ 
     4583  if ((board[SOUTH(pos)] != color) && (board[EAST(pos)] != color) && 
     4584      (board[WEST(pos)] != color) && (board[NORTH(pos)] != color)) 
     4585    return(1); 
     4586  return(0); 
     4587} 
    45604588 
    45614589/* 
    45624590 * (str) points to a group.