Ticket #148: changes2.diff
| File changes2.diff, 97.1 kB (added by draqo, 20 months ago) |
|---|
-
gnugo/engine/board.h
RCS file: /sources/gnugo/gnugo/engine/board.h,v retrieving revision 1.34 diff -u -r1.34 board.h
36 36 * character access is very slow. 37 37 */ 38 38 39 /* simple test for old machines */ 40 #if SIZEOF_INT >= 4 41 #define INT_INTERSECTION 42 typedef int Intersection; 43 #else 39 44 typedef unsigned char Intersection; 45 #endif 40 46 41 47 /* FIXME: This is very ugly but we can't include hash.h until we have 42 48 * defined Intersection. And we do need to include it before using … … 135 141 136 142 /* Note that POS(-1, -1) == 0 137 143 * DELTA() is defined so that POS(i+di, j+dj) = POS(i, j) + DELTA(di, dj). 144 * For details look in the documentation. 138 145 */ 139 146 #define BOARDSIZE ((MAX_BOARD + 2) * (MAX_BOARD + 1) + 1) 140 147 #define BOARDMIN (MAX_BOARD + 2) … … 148 155 #define NS (MAX_BOARD + 1) 149 156 #define WE 1 150 157 #define SOUTH(pos) ((pos) + NS) 151 #define WEST(pos) ((pos) - 1)158 #define WEST(pos) ((pos) - WE) 152 159 #define NORTH(pos) ((pos) - NS) 153 #define EAST(pos) ((pos) + 1)154 #define SW(pos) ((pos) + NS - 1)155 #define NW(pos) ((pos) - NS - 1)156 #define NE(pos) ((pos) - NS + 1)157 #define SE(pos) ((pos) + NS + 1)160 #define EAST(pos) ((pos) + WE) 161 #define SW(pos) ((pos) + NS - WE) 162 #define NW(pos) ((pos) - NS - WE) 163 #define NE(pos) ((pos) - NS + WE) 164 #define SE(pos) ((pos) + NS + WE) 158 165 #define SS(pos) ((pos) + 2 * NS) 159 #define WW(pos) ((pos) - 2 )166 #define WW(pos) ((pos) - 2 * WE) 160 167 #define NN(pos) ((pos) - 2 * NS) 161 #define EE(pos) ((pos) + 2 )168 #define EE(pos) ((pos) + 2 * WE) 162 169 163 170 #define DIRECT_NEIGHBORS(pos1, pos2) \ 164 171 ((pos1) == SOUTH(pos2) \ … … 260 267 /* Functions handling the permanent board state. */ 261 268 void clear_board(void); 262 269 int test_gray_border(void); 263 void setup_board(Intersection new_board[MAX_BOARD][MAX_BOARD], int ko_pos,264 int *last, float new_komi, int w_captured, int b_captured);265 270 void add_stone(int pos, int color); 266 271 void remove_stone(int pos); 267 272 void play_move(int pos, int color); … … 271 276 void restore_board(struct board_state *state); 272 277 273 278 /* Information about the permanent board. */ 274 in t get_last_move(void);275 in t get_last_player(void);279 inline int get_last_move(void); 280 inline int get_last_player(void); 276 281 int get_last_opponent_move(int color); 277 282 int stones_on_board(int color); 278 283 279 284 /* Functions handling the variable board state. */ 280 int trymove(int pos, int color, const char *message, int str );285 int trymove(int pos, int color, const char *message, int str_pos); 281 286 int tryko(int pos, int color, const char *message); 282 287 void popgo(void); 283 288 int komaster_trymove(int pos, int color, 284 289 const char *message, int str, 285 290 int *is_conditional_ko, int consider_conditional_ko); 286 in t get_komaster(void);287 in t get_kom_pos(void);291 inline int get_komaster(void); 292 inline int get_kom_pos(void); 288 293 289 294 int move_in_stack(int pos, int cutoff); 290 void get_move_from_stack(int k, int *move, int *color);295 inline void get_move_from_stack(int k, int *move, int *color); 291 296 void dump_stack(void); 292 297 void do_dump_stack(void); 293 298 294 void reset_trymove_counter(void); 295 int get_trymove_counter(void); 299 void dump_incremental_board(void); 300 301 inline void reset_trymove_counter(void); 302 inline int get_trymove_counter(void); 296 303 297 304 /* move properties */ 298 in t is_pass(int pos);305 inline int is_pass(int pos); 299 306 int is_legal(int pos, int color); 300 307 int is_suicide(int pos, int color); 301 in t is_illegal_ko_capture(int pos, int color);308 inline int is_illegal_ko_capture(int pos, int color); 302 309 int is_allowed_move(int pos, int color); 303 310 int is_ko(int pos, int color, int *ko_pos); 304 311 int is_ko_point(int pos); … … 306 313 int is_self_atari(int pos, int color); 307 314 308 315 /* Purely gemoetric functions */ 309 in t is_edge_vertex(int pos);310 in t is_corner_vertex(int pos);311 in t edge_distance(int pos);312 in t square_dist(int pos1, int pos2);316 inline int is_edge_vertex(int pos); 317 inline int is_corner_vertex(int pos); 318 inline int edge_distance(int pos); 319 inline int square_dist(int pos1, int pos2); 313 320 314 321 /* Basic string information. */ 315 int find_origin(int str); 316 int chainlinks(int str, int adj[MAXCHAIN]); 317 int chainlinks2(int str, int adj[MAXCHAIN], int lib); 318 int chainlinks3(int str, int adj[MAXCHAIN], int lib); 319 int extended_chainlinks(int str, int adj[MAXCHAIN], int both_colors); 320 321 int liberty_of_string(int pos, int str); 322 int second_order_liberty_of_string(int pos, int str); 323 int neighbor_of_string(int pos, int str); 324 int has_neighbor(int pos, int color); 325 int same_string(int str1, int str2); 326 int adjacent_strings(int str1, int str2); 322 inline int find_origin(int str_pos); 323 int chainlinks(int str_pos, int adj[MAXCHAIN]); 324 int chainlinks2(int str_pos, int adj[MAXCHAIN], int lib); 325 int chainlinks3(int str_pos, int adj[MAXCHAIN], int lib); 326 int extended_chainlinks(int str_pos, int adj[MAXCHAIN], int both_colors); 327 328 int liberty_of_string(int pos, int str_pos); 329 int liberty_of_string2(int pos, int str_pos); 330 int second_order_liberty_of_string(int pos, int str_pos); 331 int neighbor_of_string(int pos, int str_pos); 332 inline int has_neighbor(int pos, int color); 333 inline int same_string(int str1_pos, int str2_pos); 334 int adjacent_strings(int str1_pos, int str2_pos); 327 335 void mark_string(int str, signed char mx[BOARDMAX], signed char mark); 328 336 int are_neighbors(int pos1, int pos2); 329 337 330 /* Count and/or find liberties at (pos) .*/331 in t countlib(int str);332 int findlib(int str , int maxlib, int *libs);338 /* Count and/or find liberties at (pos) */ 339 inline int countlib(int str_pos); 340 int findlib(int str_pos, int maxlib, int *libs); 333 341 int fastlib(int pos, int color, int ignore_captures); 334 342 int approxlib(int pos, int color, int maxlib, int *libs); 335 343 int accuratelib(int pos, int color, int maxlib, int *libs); 336 int count_common_libs(int str1 , int str2);337 int find_common_libs(int str1 , int str2, int maxlib, int *libs);338 int have_common_lib(int str1 , int str2, int *lib);344 int count_common_libs(int str1_pos, int str2_pos); 345 int find_common_libs(int str1_pos, int str2_pos, int maxlib, int *libs); 346 int have_common_lib(int str1_pos, int str2_pos, int *lib); 339 347 340 348 /* Count the number of stones in a string. */ 341 in t countstones(int str);342 int findstones(int str , int maxstones, int *stones);343 int count_adjacent_stones(int str1 , int str2, int maxstones);349 inline int countstones(int str_pos); 350 int findstones(int str_pos, int maxstones, int *stones); 351 int count_adjacent_stones(int str1_pos, int str2_pos, int maxstones); 344 352 345 353 /* Special function for reading.c */ 346 void incremental_order_moves(int move, int color, int string,354 void incremental_order_moves(int move, int color, int target_pos, 347 355 int *number_edges, int *number_same_string, 348 356 int *number_own, int *number_opponent, 349 357 int *captured_stones, int *threatened_stones, 350 358 int *saved_stones, int *number_open); 351 359 352 360 /* Board caches initialization functions. */ 353 void clear_approxlib_cache(void);354 void clear_accuratelib_cache(void);361 inline void clear_approxlib_cache(void); 362 inline void clear_accuratelib_cache(void); 355 363 356 364 357 365 /* Is this point inside the board? */ … … 381 389 * south, west, north, east, southwest, northwest, northeast, southeast. 382 390 * Defined in board.c. 383 391 */ 384 extern int deltai[8]; /* = { 1, 0, -1, 0, 1, -1, -1, 1}; */385 extern int deltaj[8]; /* = { 0, -1, 0, 1, -1, -1, 1, 1}; */386 extern int delta[8]; /* = { NS, -1, -NS, 1, NS-1, -NS-1, -NS+1, NS+1}; */392 extern const int deltai[8]; /* = { 1, 0, -1, 0, 1, -1, -1, 1}; */ 393 extern const int deltaj[8]; /* = { 0, -1, 0, 1, -1, -1, 1, 1}; */ 394 extern const int delta[8]; /* = { NS, -WE, -NS, WE, NS-WE, -NS-WE, -NS+WE, NS+WE}; */ 387 395 388 396 389 397 -
gnugo/engine/boardlib.c
RCS file: /sources/gnugo/gnugo/engine/boardlib.c,v retrieving revision 1.12 diff -u -r1.12 boardlib.c
29 29 /* The board state itself. */ 30 30 int board_size = DEFAULT_BOARD_SIZE; /* board size */ 31 31 Intersection board[BOARDSIZE]; 32 int board_ko_pos; 32 int board_ko_pos; /* Position of a ko (captured stone). */ 33 33 int white_captured; /* number of black and white stones captured */ 34 34 int black_captured; 35 35 … … 54 54 /* Hashing of positions. */ 55 55 Hash_data board_hash; 56 56 57 int stackp; /* stack pointer*/57 int stackp; /* moves stack depth */ 58 58 int position_number; /* position number */ 59 59 60 60 /* Some statistics gathered partly in board.c and hash.c */ -
gnugo/engine/breakin.c
RCS file: /sources/gnugo/gnugo/engine/breakin.c,v retrieving revision 1.26 diff -u -r1.26 breakin.c
367 367 368 368 if (used[pos2]) 369 369 break; 370 }370 } 371 371 372 372 used[pos] = 1; 373 373 if (ON_BOARD(pos2)) … … 440 440 } 441 441 } 442 442 443 void443 inline void 444 444 clear_break_in_list() 445 445 { 446 446 num_break_ins = 0; -
gnugo/engine/cache.c
RCS file: /sources/gnugo/gnugo/engine/cache.c,v retrieving revision 1.50 diff -u -r1.50 cache.c
39 39 /* ---------------------------------------------------------------- */ 40 40 41 41 static void tt_init(Transposition_table *table, int memsize); 42 static void tt_clear(Transposition_table *table);42 inline static void tt_clear(Transposition_table *table); 43 43 44 44 /* The transposition table itself. */ 45 45 Transposition_table ttable; … … 72 72 calculate_hashval_for_tt(Hash_data *hashdata, int routine, int target1, 73 73 int target2, Hash_data *extra_hash) 74 74 { 75 *hashdata = board_hash; /* from globals.c */75 *hashdata = board_hash; /* from boardlib.c */ 76 76 hashdata_xor(*hashdata, routine_hash[routine]); 77 77 hashdata_xor(*hashdata, target1_hash[target1]); 78 78 if (target2 != NO_MOVE) … … 97 97 keyhash_init(); 98 98 99 99 if (memsize > 0) 100 num_entries = memsize / sizeof( table->entries[0]);100 num_entries = memsize / sizeof(Hashentry); 101 101 else 102 102 num_entries = DEFAULT_NUMBER_OF_CACHE_ENTRIES; 103 103 104 104 table->num_entries = num_entries; 105 table->entries = malloc(num_entries * sizeof( table->entries[0]));105 table->entries = malloc(num_entries * sizeof(Hashentry)); 106 106 107 107 if (table->entries == NULL) { 108 108 perror("Couldn't allocate memory for transposition table. \n"); 109 109 exit(1); 110 110 } 111 111 112 table->is_clean = 0;113 112 tt_clear(table); 114 113 } 115 114 116 115 117 116 /* Clear the transposition table. */ 118 117 119 static void118 inline static void 120 119 tt_clear(Transposition_table *table) 121 120 { 122 if (!table->is_clean) { 123 memset(table->entries, 0, table->num_entries * sizeof(table->entries[0])); 124 table->is_clean = 1; 125 } 121 memset(table->entries, 0, table->num_entries * sizeof(Hashentry)); 126 122 } 127 128 123 124 129 125 /* Free the transposition table. */ 130 126 131 void127 inline void 132 128 tt_free(Transposition_table *table) 133 129 { 134 130 free(table->entries); 135 131 } 136 132 137 133 138 /* Get result and move. Return value: 134 /* Get result and move (the bigger remaining depth the lower depth). 135 * Return value: 139 136 * 0 if not found 140 * 1 if found, but depth too smallto be trusted. In this case the move137 * 1 if found, but depth too big to be trusted. In this case the move 141 138 * can be used for move ordering. 142 * 2 if found and depth is enough so that the result can be trusted.139 * 2 if found and depth is small enough so that the result can be trusted. 143 140 */ 144 141 145 142 int … … 162 159 163 160 /* Get the correct entry and node. */ 164 161 entry = &table->entries[hashdata_remainder(hashval, table->num_entries)]; 165 if (hashdata_is_equal(hashval, entry->deepest.key)) 166 node = &entry->deepest; 162 163 if (hashdata_is_equal(hashval, entry->most_reliable.key)) 164 node = &entry->most_reliable; 167 165 else if (hashdata_is_equal(hashval, entry->newest.key)) 168 166 node = &entry->newest; 169 167 else 170 168 return 0; 171 169 172 stats.read_result_hits++; 170 #ifndef GG_TURN_OFF_STATS 171 ++stats.read_result_hits; 172 #endif 173 173 174 174 /* Return data. Only set the result if remaining depth in the table 175 175 * is big enough to be trusted. The move can always be used for move … … 177 177 */ 178 178 if (move) 179 179 *move = hn_get_move(node->data); 180 180 181 if (remaining_depth <= (int) hn_get_remaining_depth(node->data)) { 181 182 if (value1) 182 183 *value1 = hn_get_value1(node->data); 183 184 if (value2) 184 185 *value2 = hn_get_value2(node->data); 185 stats.trusted_read_result_hits++; 186 187 #ifndef GG_TURN_OFF_STATS 188 ++stats.trusted_read_result_hits; 189 #endif 190 186 191 return 2; 187 192 } 188 193 … … 201 206 { 202 207 Hash_data hashval; 203 208 Hashentry *entry; 204 Hashnode * deepest;209 Hashnode *most_reliable; 205 210 Hashnode *newest; 206 211 unsigned int data; 207 212 /* Get routine costs definitions from liberty.h. */ … … 220 225 221 226 /* Get the entry and nodes. */ 222 227 entry = &table->entries[hashdata_remainder(hashval, table->num_entries)]; 223 deepest = &entry->deepest;228 most_reliable = &entry->most_reliable; 224 229 newest = &entry->newest; 225 230 226 231 /* See if we found an already existing node. */ 227 if (hashdata_is_equal(hashval, deepest->key) 228 && remaining_depth >= (int) hn_get_remaining_depth(deepest->data)) { 229 230 /* Found deepest */ 231 deepest->data = data; 232 232 if (hashdata_is_equal(hashval, most_reliable->key)) 233 { 234 /* Found shallower node (can be trusted more likely) */ 235 if (remaining_depth > (int) hn_get_remaining_depth(most_reliable->data)) 236 most_reliable->data = data; 233 237 } 234 else if (hashdata_is_equal(hashval, newest->key) 235 && remaining_depth >= (int) hn_get_remaining_depth(newest->data)) { 236 238 else if (hashdata_is_equal(hashval, newest->key)) 239 { 237 240 /* Found newest */ 238 newest->data = data; 239 240 /* If newest has become deeper than deepest, then switch them. */ 241 if (hn_get_remaining_depth(newest->data) 242 > hn_get_remaining_depth(deepest->data)) { 243 Hashnode temp; 244 245 temp = *deepest; 246 *deepest = *newest; 247 *newest = temp; 241 if (remaining_depth > (int) hn_get_remaining_depth(newest->data)) 242 { 243 newest->data = data; 244 245 /* If newest reliability is bigger than most_reliable, switch them. */ 246 if (hn_get_reliability(newest->data) > 247 hn_get_reliability(most_reliable->data)) 248 { 249 Hashnode temp; 250 251 temp = *most_reliable; 252 *most_reliable = *newest; 253 *newest = temp; 254 } 248 255 } 249 250 256 } 251 else if (hn_get_total_cost(data) > hn_get_total_cost(deepest->data)) { 252 if (hn_get_total_cost(newest->data) < hn_get_total_cost(deepest->data)) 253 *newest = *deepest; 254 deepest->key = hashval; 255 deepest->data = data; 256 } 257 else { 257 /* Have new node. */ 258 else if (hn_get_reliability(data) > 259 hn_get_reliability(most_reliable->data)) 260 { 261 /* Replace most_reliable. */ 262 most_reliable->key = hashval; 263 most_reliable->data = data; 264 } 265 else 266 { 258 267 /* Replace newest. */ 259 268 newest->key = hashval; 260 269 newest->data = data; 261 270 } 262 271 263 stats.read_result_entered++; 264 table->is_clean = 0; 272 #ifndef GG_TURN_OFF_STATS 273 ++stats.read_result_entered; 274 #endif 265 275 } 266 276 267 277 … … 270 280 }; 271 281 272 282 /* Convert a routine as used in the cache table to a string. */ 273 const char *283 inline const char * 274 284 routine_id_to_string(enum routine_id routine) 275 285 { 276 286 return routine_names[(int) routine]; … … 282 292 * allocate a single node or if the allocation fails, the caching is 283 293 * disabled. 284 294 */ 285 void295 inline void 286 296 reading_cache_init(int bytes) 287 297 { 288 298 tt_init(&ttable, bytes); … … 290 300 291 301 292 302 /* Clear the cache for read results. */ 293 void303 inline void 294 304 reading_cache_clear() 295 305 { 296 306 tt_clear(&ttable); 297 307 } 298 308 299 float309 inline float 300 310 reading_cache_default_size() 301 311 { 302 312 return DEFAULT_NUMBER_OF_CACHE_ENTRIES * sizeof(Hashentry) / 1024.0 / 1024.0; -
gnugo/engine/cache.h
RCS file: /sources/gnugo/gnugo/engine/cache.h,v retrieving revision 1.54 diff -u -r1.54 cache.h
32 32 * (Reading/Hashing) for more information. 33 33 */ 34 34 35 #if SIZEOF_INT == 4 36 typedef unsigned int HASHNODE_DATATYPE; 37 #elif SIZEOF_LONG == 4 38 typedef unsigned long HASHNODE_DATATYPE; 39 #elif SIZEOF_INT > 4 40 typedef unsigned short HASHNODE_DATATYPE; 41 #elif 42 #error Long type size has to be at least 4 bytes. 43 #endif 35 44 36 45 /* Hashnode: a node stored in the transposition table. 37 46 * 38 47 * In addition to the position, the hash lock encodes the following data, 39 48 * all hashed: 40 * komaster 41 * kom_pos 49 * ko 50 * komaster (look in doc) 51 * kom_pos (look in doc) 42 52 * routine 43 * str144 * str253 * target1 54 * target2 45 55 * extra hashvalue, optional (e.g. encoding a goal array) 46 56 * 47 57 * The data field packs into 32 bits the following … … 54 64 * cost : 4 bits 55 65 * remaining_depth: 5 bits (depth - stackp) NOTE: HN_MAX_REMAINING_DEPTH 56 66 * 57 * The last 9 bits together give an index for the total costs. 67 * The last 9 bits together give a reliability index (bigger index means 68 * more reliable result). 69 * Values are results of analyzed position (WIN, LOSE, etc.) 58 70 */ 59 71 typedef struct { 60 72 Hash_data key; 61 unsigned int data; /* Should be 32 bits, but only wastes 25% if 64 bits.*/73 HASHNODE_DATATYPE data; /* 32-bit value */ 62 74 } Hashnode; 63 75 64 76 #define HN_MAX_REMAINING_DEPTH 31 … … 67 79 /* Hashentry: an entry, with two nodes of the hash_table 68 80 */ 69 81 typedef struct { 70 Hashnode deepest;82 Hashnode most_reliable; 71 83 Hashnode newest; 72 84 } Hashentry; 73 85 … … 76 88 #define hn_get_value2(hn) ((hn >> 19) & 0x0f) 77 89 #define hn_get_move(hn) ((hn >> 9) & 0x3ff) 78 90 #define hn_get_cost(hn) ((hn >> 5) & 0x0f) 79 #define hn_get_remaining_depth(hn) ((hn >> 0) & 0x1f)80 #define hn_get_ total_cost(hn) ((hn >> 0) & 0x1ff)91 #define hn_get_remaining_depth(hn) ((hn/*>> 0*/) & 0x1f) 92 #define hn_get_reliability(hn) ((hn/*>> 0*/) & 0x1ff) 81 93 82 94 #define hn_create_data(remaining_depth, value1, value2, move, cost) \ 83 95 ((((value1) & 0x0f) << 23) \ 84 96 | (((value2) & 0x0f) << 19) \ 85 97 | (((move) & 0x3ff) << 9) \ 86 98 | (((cost) & 0x0f) << 5) \ 87 | (((remaining_depth & 0x1f) << 0)))99 | (((remaining_depth & 0x1f)/*<< 0*/))) 88 100 89 101 90 102 /* Transposition_table: transposition table used for caching. */ 91 103 typedef struct { 92 104 unsigned int num_entries; 93 105 Hashentry *entries; 94 int is_clean;95 106 } Transposition_table; 96 107 97 108 extern Transposition_table ttable; … … 101 112 */ 102 113 #define DEFAULT_NUMBER_OF_CACHE_ENTRIES 350000 103 114 104 void tt_free(Transposition_table *table);115 inline void tt_free(Transposition_table *table); 105 116 int tt_get(Transposition_table *table, enum routine_id routine, 106 117 int target1, int target2, int remaining_depth, 107 118 Hash_data *extra_hash, … … 141 152 int q1 = board[str1] == EMPTY ? str1 : find_origin(str1); \ 142 153 int q2 = board[str2] == EMPTY ? str2 : find_origin(str2); 143 154 155 #define READ_FUNCTION_NAME read_function_name 156 144 157 #else 145 158 146 159 #define TRACE_CACHED_RESULT(result, move) 147 160 #define TRACE_CACHED_RESULT2(result1, result2, move) 148 161 162 #ifndef GG_TURN_OFF_TRACES 163 149 164 #define SETUP_TRACE_INFO(name, str) \ 150 165 const char *read_function_name = name; \ 151 166 int q = str; … … 155 170 int q1 = str1; \ 156 171 int q2 = str2; 157 172 158 #endif159 160 /* Trace messages in decidestring/decidedragon sgf file. */161 void sgf_trace(const char *func, int str, int move, int result,162 const char *message);163 /* Trace messages in decideconnection sgf file. */164 void sgf_trace2(const char *func, int str1, int str2, int move,165 const char *result, const char *message);166 /* Trace messages in decidesemeai sgf file. */167 void sgf_trace_semeai(const char *func, int str1, int str2, int move,168 int result1, int result2, const char *message);169 170 173 /* Macro to hide the call to sgf_trace(). Notice that a little black 171 174 * magic is going on here. Before using this macro, SETUP_TRACE_INFO 172 175 * must have been called to provide the variables read_function_name … … 190 193 sgf_trace_semeai(read_function_name, q1, q2, move, \ 191 194 result1, result2, message) 192 195 196 #define READ_FUNCTION_NAME read_function_name 197 198 #else // #ifndef GG_TURN_OFF_TRACES 199 200 #define SETUP_TRACE_INFO(name, str) 201 #define SETUP_TRACE_INFO2(name, str1, str2) 202 #define SGFTRACE(move, result, message) (void)0 203 #define SGFTRACE2(move, result, message) (void)0 204 #define SGFTRACE_SEMEAI(move, result1, result2, message) (void)0 205 #define READ_FUNCTION_NAME NULL 206 207 #endif // #ifndef GG_TURN_OFF_TRACES 208 209 #endif // #if TRACE_READ_RESULTS 210 211 /* Trace messages in decidestring/decidedragon sgf file. */ 212 void sgf_trace(const char *func, int str, int move, int result, 213 const char *message); 214 /* Trace messages in decideconnection sgf file. */ 215 void sgf_trace2(const char *func, int str1, int str2, int move, 216 const char *result, const char *message); 217 /* Trace messages in decidesemeai sgf file. */ 218 void sgf_trace_semeai(const char *func, int str1, int str2, int move, 219 int result1, int result2, const char *message); 220 193 221 194 222 /* ================================================================ */ 195 223 … … 212 240 do { \ 213 241 tt_update(&ttable, routine, str, NO_MOVE, remaining_depth, NULL,\ 214 242 value, 0, move);\ 215 if ((value) != 0 && (point) != 0) *(point) = (move); \ 243 if ((point) != NULL && (value) != 0) \ 244 *(point) = (move); \ 216 245 return (value); \ 217 246 } while (0) 218 247 … … 220 249 do { \ 221 250 tt_update(&ttable, routine, str1, str2, remaining_depth, NULL, \ 222 251 value1, value2, move); \ 223 if ((value1) != 0 && (point) != 0) *(point) = (move); \ 252 if ((point) != NULL && (value1) != 0) \ 253 *(point) = (move); \ 224 254 return; \ 225 255 } while (0) 226 256 … … 228 258 do { \ 229 259 tt_update(&ttable, routine, str1, str2, remaining_depth, NULL,\ 230 260 value, 0, move);\ 231 if ((value) != 0 && (point) != 0) *(point) = (move); \ 261 if ((point) != NULL && (value) != 0) \ 262 *(point) = (move); \ 232 263 return (value); \ 233 264 } while (0) 234 265 … … 236 267 do { \ 237 268 tt_update(&ttable, routine, str, NO_MOVE, remaining_depth, hash,\ 238 269 value, 0, move);\ 239 if ((value) != 0 && (point) != 0) *(point) = (move); \ 270 if ((point) != NULL && (value) != 0) \ 271 *(point) = (move); \ 240 272 return (value); \ 241 273 } while (0) 242 274 … … 244 276 do { \ 245 277 tt_update(&ttable, routine, str, NO_MOVE, remaining_depth, NULL,\ 246 278 value1, value2, move);\ 247 if ((value1) != 0 && (point) != 0) *(point) = (move); \ 279 if ((point) != NULL && (value1) != 0) \ 280 *(point) = (move); \ 248 281 return (value1); \ 249 282 } while (0) 250 283 -
gnugo/engine/clock.c
RCS file: /sources/gnugo/gnugo/engine/clock.c,v retrieving revision 1.26 diff -u -r1.26 clock.c
