Ticket #199: gunnar_9_1.18.diff

File gunnar_9_1.18.diff, 3.2 KB (added by gunnar, 22 months ago)

Remove redundant functionality to fill in opponent eyes in semeai.

  • engine/owl.c

    diff --git a/engine/owl.c b/engine/owl.c
    index 9b87cc0..af2f59a 100644
    a b static int semeai_trymove_and_recurse(int apos, int bpos, 
    271271                                      int *this_resulta, int *this_resultb); 
    272272static void semeai_add_sgf_comment(int value, int owl_phase); 
    273273static int semeai_trust_tactical_attack(int str); 
    274 static int semeai_propose_eyespace_filling_move(struct local_owl_data *owla, 
    275                                                 struct local_owl_data *owlb); 
    276274static void semeai_review_owl_moves(struct owl_move_data owl_moves[MAX_MOVES], 
    277275                                    struct local_owl_data *owla, 
    278276                                    struct local_owl_data *owlb, int color, 
    do_owl_analyze_semeai(int apos, int bpos, 
    11401138    } 
    11411139  } 
    11421140 
    1143   if (moves[0].pos == NO_MOVE) { 
    1144     /* If no move has been found yet, see if we can fill opponent's 
    1145      * eye (i.e. put more stones in "bulky five" shape). 
    1146      */ 
    1147     if (min_eyes(&probable_eyes_b) == 1) { 
    1148       int move = semeai_propose_eyespace_filling_move(owla, owlb); 
     1141  if (moves[0].pos == NO_MOVE) 
     1142    TRACE("No move found\n"); 
    11491143 
    1150       if (move) { 
    1151         owl_add_move(moves, move, 70, "eyespace filling", 
    1152                      SAME_DRAGON_NOT_CONNECTED, NO_MOVE, 
    1153                      0, NO_MOVE, MAX_SEMEAI_MOVES, NULL); 
    1154       } 
    1155     } 
    1156  
    1157     if (moves[0].pos == NO_MOVE) 
    1158       TRACE("No move found\n"); 
    1159   } 
    1160    
    11611144  /* Now we are ready to try moves. Turn on the sgf output ... */ 
    11621145  sgf_dumptree = save_sgf_dumptree; 
    11631146  count_variations = save_count_variations; 
    semeai_review_owl_moves(struct owl_move_data owl_moves[MAX_MOVES], 
    16641647} 
    16651648 
    16661649 
    1667 /* Propose an eyespace filling move.  Such a move can, for instance, 
    1668  * add a stone to opponent's "bulky five" shape.  We of course choose 
    1669  * a move that doesn't allow opponent to turn his dead eyeshape into a 
    1670  * two eyes eyeshape.  E.g. in this position, the function will 
    1671  * propose the move at '*', not at the '.': 
    1672  * 
    1673  *       XXX 
    1674  *      XXOX 
    1675  *      XOOX 
    1676  *      X.*X 
    1677  *      ---- 
    1678  */ 
    1679 static int 
    1680 semeai_propose_eyespace_filling_move(struct local_owl_data *owla, 
    1681                                      struct local_owl_data *owlb) 
    1682 { 
    1683   int color = OTHER_COLOR(owlb->color); 
    1684   int pos; 
    1685   int mw[BOARDMAX]; 
    1686   int mz[BOARDMAX]; 
    1687  
    1688   owl_find_relevant_eyespaces(owlb, mw, mz); 
    1689  
    1690   /* Never try to fill opponent's eyes which contain our dragon.  This 
    1691    * is nothing else than suicide. 
    1692    */ 
    1693   for (pos = BOARDMIN; pos < BOARDMAX; pos++) { 
    1694     if (ON_BOARD(pos) && owla->goal[pos]) 
    1695       mw[owlb->my_eye[pos].origin] = 0; 
    1696   } 
    1697  
    1698   for (pos = BOARDMIN; pos < BOARDMAX; pos++) { 
    1699     if (board[pos] == EMPTY) { 
    1700       int origin = owlb->my_eye[pos].origin; 
    1701  
    1702       if (mw[origin] > 1 
    1703           && min_eyes(&owlb->my_eye[origin].value) == 1) { 
    1704         int good_move = 0; 
    1705  
    1706         if (trymove(pos, color, "eyespace_filling", NO_MOVE)) { 
    1707           struct eyevalue new_value; 
    1708           int dummy_attack; 
    1709           int dummy_defense; 
    1710  
    1711           compute_eyes(origin, &new_value, &dummy_attack, &dummy_defense, 
    1712                        owlb->my_eye, owlb->half_eye, 0); 
    1713           if (max_eyes(&new_value) <= 1) 
    1714             good_move = 1; 
    1715  
    1716           popgo(); 
    1717         } 
    1718  
    1719         if (good_move) 
    1720           return pos; 
    1721       } 
    1722     } 
    1723   } 
    1724  
    1725   return NO_MOVE; 
    1726 } 
    1727  
    1728  
    17291650/* Try to estimate the value of a semeai move. This has two 
    17301651 * components. The first is the change in the total number of 
    17311652 * liberties for strings involved in the semeai. The second is a bonus