Ticket #148: changes.diff

File changes.diff, 142.0 kB (added by draqo, 20 months ago)
  • gnugo/config.h.in

    RCS file: /sources/gnugo/gnugo/config.h.in,v
    retrieving revision 1.43
    diff -u -r1.43 config.h.in
     
    1212/* Center oriented influence. Disabled by default. */ 
    1313#undef COSMIC_GNUGO 
    1414 
    15 /* Default level (strength). Up to 10 supported */ 
     15/* Default level (strength). Up to 12 is recommended. */ 
    1616#undef DEFAULT_LEVEL 
    1717 
    1818/* Default hash table size in megabytes */ 
     
    2727/* GAIN/LOSS codes. Disabled by default. */ 
    2828#undef EXPERIMENTAL_OWL_EXT 
    2929 
     30/* Disable unneeded things. 0 standard. */ 
     31#undef FINAL_RELEASE 
     32 
    3033/* The concatenation of the strings "GNU ", and PACKAGE. */ 
    3134#undef GNU_PACKAGE 
    3235 
     
    103106/* Semeai Variations. 500 default */ 
    104107#undef SEMEAI_NODE_LIMIT 
    105108 
     109/* The size of a `int', as computed by sizeof. */ 
     110#undef SIZEOF_INT 
     111 
    106112/* The size of a `long', as computed by sizeof. */ 
    107113#undef SIZEOF_LONG 
    108114 
  • gnugo/configure

    RCS file: /sources/gnugo/gnugo/configure,v
    retrieving revision 1.125
    diff -u -r1.125 configure
     
    22# Guess values for system-dependent variables and create Makefiles. 
    33# Generated by Autoconf 2.52. 
    44# 
    5 # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 
     5# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2006 
    66# Free Software Foundation, Inc. 
    77# This configure script is free software; the Free Software Foundation 
    88# gives unlimited permission to copy, distribute and modify it. 
     
    673673                                         analysis (default) 
    674674  --disable-socket-support           don't compile GTP over TCP/IP support 
    675675  --enable-socket-support            compile TCP/IP support (default) 
     676  --enable-final-release             turn off additional chekcs, stats, etc. 
     677  --disable-final-release            turn on additional chekcs, stats, etc. 
    676678 
    677679Optional Packages: 
    678680  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes] 
     
    14441446 
    14451447fi; 
    14461448 
     1449# Check whether --enable-final-release or --disable-final-release was given. 
     1450if test "${enable-final-release+set}" = set; then 
     1451  enableval="$enable_final_release" 
     1452 
     1453fi; 
     1454 
    14471455ac_ext=c 
    14481456ac_cpp='$CPP $CPPFLAGS' 
    14491457ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' 
     
    33773385#define SIZEOF_LONG $ac_cv_sizeof_long 
    33783386EOF 
    33793387 
     3388echo "$as_me:3181: checking size of int" >&5 
     3389echo $ECHO_N "checking size of int... $ECHO_C" >&6 
     3390cat >conftest.$ac_ext <<_ACEOF 
     3391#line 3391 "configure" 
     3392#include "confdefs.h" 
     3393#include <stdio.h> 
     3394 
     3395int 
     3396main () 
     3397{ 
     3398FILE *f = fopen ("conftest.val", "w"); 
     3399if (!f) 
     3400  exit (1); 
     3401fprintf (f, "%d", (sizeof (int))); 
     3402fclose (f); 
     3403  ; 
     3404  return 0; 
     3405} 
     3406_ACEOF 
     3407rm -f conftest$ac_exeext 
     3408if { (eval echo "$as_me:3408: \"$ac_link\"") >&5 
     3409  (eval $ac_link) 2>&5 
     3410  ac_status=$? 
     3411  echo "$as_me:3411: \$? = $ac_status" >&5 
     3412  (exit $ac_status); } && { ac_try='./conftest$ac_exeext' 
     3413  { (eval echo "$as_me:3413: \"$ac_try\"") >&5 
     3414  (eval $ac_try) 2>&5 
     3415  ac_status=$? 
     3416  echo "$as_me:3416: \$? = $ac_status" >&5 
     3417  (exit $ac_status); }; }; then 
     3418  ac_cv_sizeof_int=`cat conftest.val` 
     3419else 
     3420  echo "$as_me: program exited with status $ac_status" >&5 
     3421echo "$as_me: failed program was:" >&5 
     3422cat conftest.$ac_ext >&5 
     3423fi 
     3424rm -f conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext 
     3425rm -f conftest.val 
     3426echo "$as_me:3426: result: $ac_cv_sizeof_int" >&5 
     3427echo "${ECHO_T}$ac_cv_sizeof_int" >&6 
     3428cat >>confdefs.h <<EOF 
     3429#define SIZEOF_INT $ac_cv_sizeof_int 
     3430EOF 
     3431 
    33803432for ac_func in vsnprintf gettimeofday usleep times 
    33813433do 
    33823434as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` 
     
    41044156 
    41054157fi 
    41064158 
     4159if test "$enable_final_release" = "yes" ; then 
     4160   cat >>confdefs.h <<\EOF 
     4161#define FINAL_RELEASE 1 
     4162EOF 
     4163 
     4164else 
     4165   cat >>confdefs.h <<\EOF 
     4166#define FINAL_RELEASE 0 
     4167EOF 
     4168 
     4169fi 
     4170 
    41074171if test "$enable_cosmic_gnugo" = "yes" ; then 
    41084172   cat >>confdefs.h <<\EOF 
    41094173#define COSMIC_GNUGO 1 
  • gnugo/configure.in

    RCS file: /sources/gnugo/gnugo/configure.in,v
    retrieving revision 1.136
    diff -u -r1.136 configure.in
     
    124124AC_ARG_ENABLE(socket-support, 
    125125 [  --disable-socket-support           don't compile GTP over TCP/IP support 
    126126  --enable-socket-support            compile TCP/IP support (default)]) 
     127   
     128AC_ARG_ENABLE(final-release, 
     129 [  --enable-final-release     turn off additional chekcs, stats, etc. 
     130  --disable-final-release    turn on additional chekcs, stats, etc. (default)]) 
    127131 
    128132AC_PROG_CC 
    129133 
     
    178182   term_header="no" 
    179183fi 
    180184 
     185AC_CHECK_SIZEOF(int,,[#include <stdio.h>]) 
    181186AC_CHECK_SIZEOF(long,,[#include <stdio.h>]) 
    182187 
    183188dnl vsnprintf not universally available 
     
    338343dnl ------------ set default level  ---------- 
    339344 
    340345AH_TEMPLATE([DEFAULT_LEVEL], 
    341 [Default level (strength). Up to 10 supported]) 
     346[Default level (strength). Up to 12 is recommended.]) 
    342347 
    343348if test "$enable_level" ; then 
    344349   AC_DEFINE_UNQUOTED(DEFAULT_LEVEL, $enable_level) 
     
    491496   AC_DEFINE(OWL_THREATS, 0) 
    492497fi 
    493498 
     499dnl ------------ Final release ------------------- 
     500 
     501AH_TEMPLATE([FINAL_RELEASE], 
     502[Disable unneeded things. 0 standard.]) 
     503 
     504if test "$enable_final_release" = "yes" ; then 
     505   AC_DEFINE(FINAL_RELEASE, 1) 
     506else 
     507   AC_DEFINE(FINAL_RELEASE, 0) 
     508fi 
     509 
    494510dnl ------------ additional valgrind macros ------ 
    495511 
    496512AH_TEMPLATE([USE_VALGRIND], 
  • gnugo/engine/aftermath.c

    RCS file: /sources/gnugo/gnugo/engine/aftermath.c,v
    retrieving revision 1.61
    diff -u -r1.61 aftermath.c
     
    288288    for (k = 0; k < 4; k++) { 
    289289      int dir = delta[k]; 
    290290      int right = delta[(k+1)%4]; 
     291      int checked_pos = pos + dir; 
     292 
    291293      if (!ON_BOARD(pos - dir) 
    292           && board[pos + dir] == color 
    293           && board[pos + dir + right] == other 
    294           && board[pos + dir - right] == other 
    295           && (libs > countlib(pos + dir) 
    296               || (libs > 4 
    297                   && libs == countlib(pos + dir))) 
    298           && (DRAGON2(pos + dir).safety == INVINCIBLE 
    299               || DRAGON2(pos + dir).safety == STRONGLY_ALIVE)) { 
    300         int this_score = 20 * (owl_hotspot[pos] + reading_hotspot[pos]); 
    301         if (this_score > best_score) { 
    302           best_score = this_score; 
    303           best_scoring_move = pos; 
    304         } 
     294          && board[checked_pos] == color 
     295          && board[checked_pos + right] == other 
     296          && board[checked_pos - right] == other) { 
     297 
     298            int count_lib = countlib(checked_pos); 
     299            int safety; 
     300 
     301            if ((libs > count_lib 
     302                || (libs > 4 && libs == count_lib)) 
     303            && ((safety = DRAGON2(checked_pos).safety) == INVINCIBLE 
     304                || safety == STRONGLY_ALIVE)) { 
     305 
     306          int this_score = 20 * (owl_hotspot[pos] + reading_hotspot[pos]); 
     307          if (this_score > best_score) { 
     308            best_score = this_score; 
     309            best_scoring_move = pos; 
     310          } 
     311            } 
    305312      } 
    306313    } 
    307314  } 
     
    363370            score--; 
    364371          else { 
    365372            if (board[pos2] == color) { 
     373              int count_stones = countstones(pos2); 
     374              int count_lib = countlib(pos2); 
    366375              move_ok = 1; 
    367376              score += 7; 
    368               if (countstones(pos2) > 2) 
    369                 score++; 
    370               if (countstones(pos2) > 4) 
     377              if (count_stones > 4) 
     378                score += 2; 
     379              else if (count_stones > 2) 
    371380                score++; 
    372               if (countlib(pos2) < 4) 
    373                 score++; 
    374               if (countlib(pos2) < 3) 
     381              if (count_lib < 3) 
     382                score += 2; 
     383              else if (count_lib < 4) 
    375384                score++; 
    376385            } 
    377             else { 
     386            else { /* board[pos2] == other */ 
    378387              int deltalib = (approxlib(pos, other, MAXLIBS, NULL) 
    379388                              - countlib(pos2)); 
    380389              move_ok = 1; 
    381390              score++; 
    382               if (deltalib >= 0) 
    383                 score++; 
    384391              if (deltalib > 0) 
     392                score += 2; 
     393              else if (deltalib >= 0) 
    385394                score++; 
    386395            } 
    387396            mark_string(pos2, mx, mark); 
     
    470479 
    471480        if (!mx[origin] && dragon[pos2].status == DEAD) { 
    472481          bonus++; 
    473           if (k < 4  
    474               && countlib(pos2) <= 2  
    475               && countstones(pos2) >= 3) 
    476             bonus++; 
     482          if (k < 4) { 
     483            int count_lib = countlib(pos2); 
     484            if (count_lib <= 2 
     485                && countstones(pos2) >= 3) 
     486              bonus++; 
    477487           
    478           if (k < 4 && countlib(pos2) == 1) 
    479             bonus += 3; 
     488            if (count_lib == 1) 
     489              bonus += 3; 
     490          } 
    480491        } 
    481492        mx[origin] = 1; 
    482       } 
     493          } 
    483494      else if (board[pos2] == color) { 
    484495        dragons[pos] = pos2; 
    485496         
     
    491502         
    492503        if (k < 4) { 
    493504          int apos = worm[pos2].origin; 
     505          int count_lib = countlib(apos); 
    494506           
    495507          if (!mx[apos]) { 
    496508            own_worms++; 
    497509            if (countstones(apos) == 1) 
    498510              bonus += 2; 
    499             if (countlib(apos) < 6 
    500                 && approxlib(pos, color, 5, NULL) < countlib(apos)) 
     511            if (count_lib < 6 
     512                && approxlib(pos, color, 5, NULL) < count_lib) 
    501513              bonus -= 5; 
    502514            mx[apos] = 1; 
    503515          } 
    504516           
    505           if (countlib(apos) <= 2) { 
     517          if (count_lib <= 2) { 
    506518            int r; 
    507519            int important = 0; 
    508520            int safe_atari = 0; 
     
    612624      int move_ok = 1; 
    613625      if (libs < 5) { 
    614626        for (k = 0; k < 4; k++) { 
    615           if (board[move + delta[k]] == color 
    616               && countlib(move + delta[k]) > libs) 
     627          int checked_pos = move + delta[k]; 
     628          if (board[checked_pos] == color 
     629              && countlib(checked_pos) > libs) 
    617630            break; 
    618631        } 
    619632        if (k < 4) { 
     
    681694          break; 
    682695        } 
    683696      } 
    684     } 
     697        } 
    685698    if (target == NO_MOVE) 
    686699      continue; 
    687700     
     
    723736        cc = pos + delta[k]; 
    724737        break; 
    725738      } 
    726     } 
     739        } 
    727740     
    728741    /* Copy the potential move to (move). */ 
    729742    move = pos; 
     
    733746     * potential move possible. 
    734747     */ 
    735748    if (!self_atari_ok) { 
    736       while (countlib(pos) == 1) { 
     749      int count_lib; 
     750      while ((count_lib = countlib(pos)) == 1) { 
    737751        int lib; 
    738752        findlib(pos, 1, &lib); 
    739753        move = lib; 
     
    741755          break; 
    742756      } 
    743757       
    744       if (countlib(pos) == 1) 
     758      if (count_lib == 1) 
    745759        move = NO_MOVE; 
    746760    } 
    747761 
  • gnugo/engine/board.c

    RCS file: /sources/gnugo/gnugo/engine/board.c,v
    retrieving revision 1.119
    diff -u -r1.119 board.c
     
    3232#include "hash.h" 
    3333#include "sgftree.h" 
    3434#include "gg_utils.h" 
     35#include "gnugo.h" 
    3536 
    3637#include <stdio.h> 
    3738#include <string.h> 
     
    9192 * exceeds 40. But since we have no way to recover from running out of 
    9293 * stack space, we allocate with a substantial safety margin. 
    9394 */ 
     95#ifdef INT_INTERSECTION 
     96#define STACK_SIZE 2 * 80 * MAXSTACK 
     97#else 
    9498#define STACK_SIZE 80 * MAXSTACK 
     99#endif 
     100 
     101#ifdef INT_INTERSECTION 
     102 
     103#define CLEAR_STACKS() do { \ 
     104  change_stack_pointer = change_stack; \ 
     105  VALGRIND_MAKE_WRITABLE(change_stack, sizeof(change_stack)); \ 
     106} while (0) 
     107 
     108/* Begin a record : address == NULL */ 
     109#define BEGIN_CHANGE_RECORD()\ 
     110((change_stack_pointer++)->address = NULL) 
     111 
     112/* PUSH_VERTEX should be the same as PUSH_VALUE when Intersection is 
     113 * int type */ 
     114 
     115/* Save a value : store the address and the value in the stack */ 
     116#define PUSH_VALUE(v)\ 
     117(change_stack_pointer->address = &(v),\ 
     118 (change_stack_pointer++)->value = (v)) 
     119 
     120/* Save a board value : store the address and the value in the stack */ 
     121#define PUSH_VERTEX(v)\ 
     122(change_stack_pointer->address = &(v),\ 
     123 (change_stack_pointer++)->value = (v)) 
     124 
     125#define POP_MOVE()\ 
     126  while ((--change_stack_pointer)->address)\ 
     127  *(change_stack_pointer->address) =\ 
     128  change_stack_pointer->value 
    95129 
     130#else 
    96131 
    97132#define CLEAR_STACKS() do { \ 
    98133  change_stack_pointer = change_stack; \ 
     
    119154#define POP_MOVE()\ 
    120155  while ((--change_stack_pointer)->address)\ 
    121156  *(change_stack_pointer->address) =\ 
    122   change_stack_pointer->value 
    123  
    124  
    125 #define POP_VERTICES()\ 
     157  change_stack_pointer->value; 
    126158  while ((--vertex_stack_pointer)->address)\ 
    127159  *(vertex_stack_pointer->address) =\ 
    128160  vertex_stack_pointer->value 
     161#endif 
    129162 
    130163 
    131164/* ================================================================ */ 
     
    138171static struct string_liberties_data string_libs[MAX_STRINGS]; 
    139172static struct string_neighbors_data string_neighbors[MAX_STRINGS]; 
    140173 
    141 /* Stacks and stack pointers. */ 
     174/* Stacks and stack pointers. Used for undoing changes on the board */ 
    142175static struct change_stack_entry change_stack[STACK_SIZE]; 
    143176static struct change_stack_entry *change_stack_pointer; 
    144177 
     178#ifndef INT_INTERSECTION 
    145179static struct vertex_stack_entry vertex_stack[STACK_SIZE]; 
    146180static struct vertex_stack_entry *vertex_stack_pointer; 
     181#endif 
    147182 
    148183 
    149184/* Index into list of strings. The index is only valid if there is a 
     
    164199/* Macros to traverse the stones of a string. 
    165200 * 
    166201 * Usage: 
    167  * int s, pos; 
    168  * s = find_the_string() 
    169  * pos = FIRST_STONE(s); 
     202 * int first, s, pos; 
     203 * s = find_the_string(); 
     204 * first = FIRST_STONE(s); 
     205 * pos = first; 
    170206 *   do { 
    171207 *    use_stone(pos); 
    172208 *    pos = NEXT_STONE(pos); 
    173  *  } while (!BACK_TO_FIRST_STONE(s, pos)); 
     209 *  } while (pos != first); 
    174210 */ 
    175211#define FIRST_STONE(s) \ 
    176212  (string[s].origin) 
     
    178214#define NEXT_STONE(pos) \ 
    179215  (next_stone[pos]) 
    180216 
    181 #define BACK_TO_FIRST_STONE(s, pos) \ 
    182   ((pos) == string[s].origin) 
    183  
    184217 
    185218/* Assorted useful macros. 
    186219 * 
     
    197230#define MARK_LIBERTY(pos) \ 
    198231  ml[pos] = liberty_mark 
    199232 
    200 #define UNMARKED_STRING(pos) \ 
    201   (string[string_number[pos]].mark != string_mark) 
     233#define UNMARKED_STRING(str_nr) \ 
     234  (string[str_nr].mark != string_mark) 
    202235 
    203236/* Note that these two macros are not complementary. Both return 
    204237 * false if board[pos] != color. 
     
    211244  (board[pos] == color\ 
    212245   && string[string_number[pos]].mark == string_mark) 
    213246 
    214 #define MARK_STRING(pos) string[string_number[pos]].mark = string_mark 
     247#define MARK_STRING(str_nr) string[str_nr].mark = string_mark 
    215248 
    216249#define STRING_AT_VERTEX(pos, s, color)\ 
    217   ((board[pos] == color) && string_number[pos] == (s)) 
     250  ((board[pos] == (color)) && string_number[pos] == (s)) 
    218251 
    219252#define NEIGHBOR_OF_STRING(pos, s, color)\ 
    220253  (STRING_AT_VERTEX(SOUTH(pos), s, color)\ 
     
    245278  (STRING_AT_VERTEX(EAST(pos), s, color)\ 
    246279   || STRING_AT_VERTEX(SOUTH(pos), s, color)\ 
    247280   || STRING_AT_VERTEX(NORTH(pos), s, color)) 
    248    
    249 #define LIBERTIES(pos)\ 
    250   string[string_number[pos]].liberties 
    251281 
    252 #define COUNTSTONES(pos) \ 
    253   string[string_number[pos]].size 
     282#define LIBERTIES(str_nr)\ 
     283  string[str_nr].liberties 
     284 
     285#define COUNTSTONES(str_nr) \ 
     286  string[str_nr].size 
    254287 
    255288#define ADD_LIBERTY(s, pos)\ 
    256289  do {\ 
     
    267300    ml[pos] = liberty_mark;\ 
    268301  } while (0) 
    269302 
    270 #define ADD_NEIGHBOR(s, pos)\ 
    271   string_neighbors[s].list[string[s].neighbors++] = string_number[pos] 
     303#define ADD_NEIGHBOR(s1, s2)\ 
     304  string_neighbors[s1].list[string[s1].neighbors++] = s2 
    272305 
    273306#define DO_ADD_STONE(pos, color)\ 
    274307  do {\ 
     
    304337static int do_trymove(int pos, int color, int ignore_ko); 
    305338static void undo_trymove(void); 
    306339 
    307 static int do_approxlib(int pos, int color, int maxlib, int *libs); 
    308 static int slow_approxlib(int pos, int color, int maxlib, int *libs); 
    309 static int do_accuratelib(int pos, int color, int maxlib, int *libs); 
     340 
     341struct board_cache_entry { 
     342  int threshold; /* a number of checked, possible liberties 
     343                  * (liberties <= threshold) */ 
     344  int liberties; /* number of liberties (if liberties == threshold 
     345                  * there is maybe more liberties) */ 
     346  Hash_data position_hash; 
     347}; 
     348 
     349inline static int do_approxlib(int pos, int color, int maxlib, int *libs, 
     350                                                           struct board_cache_entry *entry); 
     351inline static int slow_approxlib(int pos, int color, int maxlib, int *libs, 
     352                                                                 struct board_cache_entry *entry); 
     353inline static int do_accuratelib(int pos, int color, int maxlib, int *libs, 
     354                                                                 struct board_cache_entry *entry); 
    310355 
    311356static int is_superko_violation(int pos, int color, enum ko_rules type); 
    312357 
    313358static void new_position(void); 
    314 static int propagate_string(int stone, int str); 
    315 static void find_liberties_and_neighbors(int s); 
    316 static int do_remove_string(int s); 
     359static int propagate_string(int stone_pos, int str_pos, int color); 
     360static void find_liberties_and_neighbors(int str_nr); 
     361static int do_remove_string(int str_nr); 
    317362static void do_commit_suicide(int pos, int color); 
    318363static void do_play_move(int pos, int color); 
    319364 
     
    326371/* Coordinates for the eight directions, ordered 
    327372 * south, west, north, east, southwest, northwest, northeast, southeast. 
    328373 */ 
    329 int deltai[8] = { 1,  0, -1,  0,  1, -1, -1, 1}; 
    330 int deltaj[8] = { 0, -1,  0,  1, -1, -1,  1, 1}; 
    331 int delta[8]  = { NS, -1, -NS, 1, NS-1, -NS-1, -NS+1, NS+1}; 
     374const int deltai[8] = { 1,  0, -1,  0,  1, -1, -1, 1}; 
     375const int deltaj[8] = { 0, -1,  0,  1, -1, -1,  1, 1}; 
     376const int delta[8]  = { NS, -WE, -NS, WE, NS-WE, -NS-WE, -NS+WE, NS+WE}; 
    332377 
    333378 
    334379/* ================================================================ */ 
     
    448493 
    449494  handicap = 0; 
    450495   
    451   hashdata_recalc(&board_hash, board, board_ko_pos); 
     496  hashdata_recalc(&board_hash, board, NO_MOVE); 
    452497  new_position(); 
    453498} 
    454499 
     
    496541 *   }    
    497542 * 
    498543 * The message can be written as a comment to an sgf file using  
    499  * sgfdump(). str can be NO_MOVE if it is not needed but otherwise   
    500  * the location of str is included in the comment. 
     544 * sgfdump(). 
     545 * str_pos is currently not used by function 
    501546 */ 
    502547 
    503548int  
    504 trymove(int pos, int color, const char *message, int str) 
     549trymove(int pos, int color, const char *message, int str_pos) 
    505550{ 
    506   UNUSED(str); 
     551  UNUSED(str_pos); 
     552 
    507553  /* Do the real work elsewhere. */ 
    508554  if (!do_trymove(pos, color, 0)) 
    509555    return 0; 
    510556 
     557#ifndef GG_TURN_OFF_TRACES 
    511558  /* Store the move in an sgf tree if one is available. */ 
    512559  if (sgf_dumptree) { 
    513560    char buf[100]; 
     
    540587    sgftreeAddPlayLast(sgf_dumptree, color, I(pos), J(pos)); 
    541588    sgftreeAddComment(sgf_dumptree, buf); 
    542589  } 
    543    
     590#else 
     591  UNUSED(message); 
     592#endif 
     593 
    544594  if (count_variations) 
    545595    count_variations++; 
     596 
     597#ifndef GG_TURN_OFF_STATS 
    546598  stats.nodes++; 
     599#endif 
    547600 
    548601  return 1; 
    549602} 
     
    567620  if (!do_trymove(pos, color, 1)) 
    568621    return 0; 
    569622 
     623#ifndef GG_TURN_OFF_TRACES 
    570624  if (sgf_dumptree) { 
    571625    char buf[100]; 
    572626    if (message == NULL) 
    573627      message = "UNKNOWN"; 
    574628    if (komaster != EMPTY) 
    575       gg_snprintf(buf, 100, "tryko: %s (variation %d, %s, komaster %s:%s)",  
    576                   message, count_variations, hashdata_to_string(&board_hash), 
     629      gg_snprintf(buf, 100, "tryko: %s at %s (variation %d, hash %s, komaster %s:%s)",  
     630                  message, location_to_string(pos), count_variations, 
     631                  hashdata_to_string(&board_hash), 
    577632                  color_to_string(komaster), location_to_string(kom_pos)); 
    578633    else 
    579       gg_snprintf(buf, 100, "tryko: %s (variation %d, %s)", message, 
     634      gg_snprintf(buf, 100, "tryko: %s at %s (variation %d, hash %s)", message, 
     635                  location_to_string(pos), 
    580636                  count_variations, hashdata_to_string(&board_hash)); 
    581637 
    582638    /* Add two pass moves to the SGF output to simulate the ko threat 
     
    595651    sgftreeAddPlayLast(sgf_dumptree, color, I(pos), J(pos)); 
    596652    sgftreeAddComment(sgf_dumptree, buf); 
    597653  } 
     654#else 
     655  UNUSED(message); 
     656#endif 
    598657   
    599658  if (count_variations) 
    600659    count_variations++; 
     660 
     661#ifndef GG_TURN_OFF_STATS 
    601662  stats.nodes++; 
     663#endif 
     664 
     665  return 1; 
     666} 
     667 
     668/* 
     669 * This function is used by komaster_trymove(). It performs checks made by trymove() 
     670 * and tryko(), so these functions have not to be called twice. It works like 
     671 * trymove() and it returns (by ko_move_allowed) the result of tryko(), but it 
     672 * doesn't call really_do_trymove() - we have to call it ourselves and function 
     673 * trykomaster_move does it for us. 
     674 */ 
     675 
     676inline static int 
     677check_komaster_move(int pos, int color, int *ko_move_allowed) 
     678{ 
     679  *ko_move_allowed = 0; 
     680 
     681  /* 1. The color must be BLACK or WHITE. */ 
     682  gg_assert(color == BLACK || color == WHITE); 
     683  
     684  if (pos != PASS_MOVE) { 
     685    /* 2. Unless pass, the move must be inside the board. */ 
     686    ASSERT_ON_BOARD1(pos); 
     687     
     688    /* Update the reading tree shadow. */ 
     689    shadow[pos] = 1; 
     690 
     691    /* 3. The location must be empty. */ 
     692    if (board[pos] != EMPTY) 
     693      return 0; 
     694     
     695    /* 4. Test if the location is the ko point. */ 
     696        if (pos == board_ko_pos) { 
     697      /*    The ko position is guaranteed to have all neighbors of the 
     698       *    same color, or off board. If that color is the same as the 
     699       *    move the ko is being filled, it is always allowed. This 
     700       *    could be tested with has_neighbor() but here a faster test 
     701       *    suffices. 
     702       */ 
     703          if (board[WEST(pos)] == OTHER_COLOR(color) 
     704              || board[EAST(pos)] == OTHER_COLOR(color)) 
     705        *ko_move_allowed = 1; 
     706        } 
     707 
     708    /* 5. Test for suicide. */ 
     709        if (is_suicide(pos, color)) { 
     710      *ko_move_allowed = 0; 
     711      return 0; 
     712    }