Ticket #211: gunnar_9_1.1.diff

File gunnar_9_1.1.diff, 2.3 KB (added by gunnar, 3 years ago)

Bugfix for aftermath scoring of sekis with chinese scoring.

  • engine/aftermath.c

    diff --git a/engine/aftermath.c b/engine/aftermath.c
    index b295a89..0d24525 100644
    a b play_aftermath(int color, SGFTree *aftermath_sgftree) 
    11431143        a->final_status[pos] = ALIVE; 
    11441144    } 
    11451145    else { 
    1146       if (board[pos] == EMPTY) 
     1146      if (board[pos] == EMPTY) { 
     1147        int enclosing_color = examine_cavity(pos, NULL); 
    11471148        a->final_status[pos] = DAME; 
     1149        if (enclosing_color == BLACK) 
     1150          a->black_area++; 
     1151        else if (enclosing_color == WHITE) 
     1152          a->white_area++; 
     1153      } 
    11481154      else { 
    11491155        a->final_status[pos] = ALIVE_IN_SEKI; 
    11501156        if (board[pos] == WHITE) 
  • engine/liberty.h

    diff --git a/engine/liberty.h b/engine/liberty.h
    index 416cd29..2da94e2 100644
    a b void get_lively_stones(int color, signed char safe_stones[BOARDMAX]); 
    333333int is_same_worm(int w1, int w2); 
    334334int is_worm_origin(int w, int pos); 
    335335void propagate_worm(int pos); 
     336int examine_cavity(int pos, int *edge); 
    336337void find_cuts(void); 
    337338void find_connections(void); 
    338339 
  • engine/worm.c

    diff --git a/engine/worm.c b/engine/worm.c
    index 55dfc7f..5fedcf9 100644
    a b static void change_tactical_point(int str, int move, int code, 
    4444static void propagate_worm2(int str); 
    4545static int genus(int str); 
    4646static void markcomponent(int str, int pos, int mg[BOARDMAX]); 
    47 static int examine_cavity(int pos, int *edge); 
    4847static void cavity_recurse(int pos, int mx[BOARDMAX],  
    4948                           int *border_color, int *edge, int str); 
    5049static void ping_cave(int str, int *result1,  int *result2, 
    markcomponent(int str, int pos, int mg[BOARDMAX]) 
    14601459 * edge in a point outside the removed string.   
    14611460 */ 
    14621461 
    1463 static int 
     1462int 
    14641463examine_cavity(int pos, int *edge) 
    14651464{ 
    14661465  int border_color = EMPTY; 
    examine_cavity(int pos, int *edge) 
    14681467  int origin = NO_MOVE; 
    14691468   
    14701469  ASSERT_ON_BOARD1(pos); 
    1471   gg_assert(edge != NULL); 
    14721470   
    14731471  memset(ml, 0, sizeof(ml)); 
    14741472 
    1475   *edge = 0; 
     1473  if (edge) 
     1474    *edge = 0; 
    14761475 
    14771476  if (IS_STONE(board[pos])) 
    14781477    origin = find_origin(pos); 
    cavity_recurse(int pos, int mx[BOARDMAX], 
    15241523 
    15251524  mx[pos] = 1; 
    15261525 
    1527   if (is_edge_vertex(pos) && board[pos] == EMPTY)  
     1526  if (edge && is_edge_vertex(pos) && board[pos] == EMPTY)  
    15281527    (*edge)++; 
    15291528 
    15301529  /* Loop over the four neighbors. */