Ticket #148: doc.diff
| File doc.diff, 40.2 KB (added by draqo, 5 years ago) |
|---|
-
gnugo/doc/board.texi
RCS file: /sources/gnugo/gnugo/doc/board.texi,v retrieving revision 1.15 diff -u -r1.15 board.texi
71 71 @group 72 72 73 73 int board_size; 74 Intersection board[ MAXSIZE];74 Intersection board[BOARDSIZE]; 75 75 int board_ko_pos; 76 76 77 77 float komi; 78 78 int white_captured; 79 79 int black_captured; 80 80 81 Hash_data hashdata;81 Hash_data board_hash; 82 82 @end group 83 83 @end example 84 84 85 The description of the @code{ Position} struct is applicable to these85 The description of the @code{board_state} struct is applicable to these 86 86 variables also, so we won't duplicate it here. All these variables are 87 87 globals for performance reasons. Behind these variables, there are a 88 88 number of other private data structures. These implement incremental 89 89 handling of strings, liberties and other properties 90 (@pxref{Incremental Board}). The variable @code{ hashdata} contains information90 (@pxref{Incremental Board}). The variable @code{board_hash} contains information 91 91 about the hash value for the current position (@pxref{Hashing}). 92 92 93 93 These variables should never be manipulated directly, since they are … … 181 181 #define NS (MAX_BOARD + 1) 182 182 #define WE 1 183 183 #define SOUTH(pos) ((pos) + NS) 184 #define WEST(pos) ((pos) - 1)184 #define WEST(pos) ((pos) - WE) 185 185 #define NORTH(pos) ((pos) - NS) 186 #define EAST(pos) ((pos) + 1)186 #define EAST(pos) ((pos) + WE) 187 187 @end example 188 188 189 189 There are also shorthand macros @code{SW}, @code{NW}, @code{NE}, … … 209 209 often one computation is sufficient for 1D-coordinate where we would need 210 210 two with two 2D-coordinates: If we, for example, want to have the 211 211 coordinate of the upper right of @code{pos}, we can do this with 212 @code{N ORTH(EAST(pos))} instead of @code{(i+1, j-1)}.212 @code{NE(pos)} instead of @code{(i+1, j-1)}. 213 213 214 214 @strong{Important}: The 2D coordinate @code{(-1,-1)}, which is used for 215 215 pass and sometimes to indicate no point, maps to the 1D coordinate … … 240 240 a point on the board. 241 241 242 242 Often one wants to traverse the board, carrying out some function 243 at every vertex. Here are two possible ways of doing this: 244 245 @example 246 int m, n; 247 for (m = 0; m < board_size; m++) 248 for (n = 0; n < board_size; n++) @{ 249 do_something(POS(m, n)); 250 @} 251 @end example 252 253 Or: 243 at every vertex. Here are the best way of doing this (other 244 implemantations were tested and are slower on 19x19 board): 254 245 255 246 @example 256 247 int pos; … … 273 264 @item Number of stones in the string. 274 265 @item Origin of the string, i.e. a canonical reference point, defined 275 266 to be the stone with smallest 1D board coordinate. 276 @item A list of the stones in the string .267 @item A list of the stones in the string (linked in a cycle). 277 268 @item Number of liberties. 278 269 @item A list of the liberties. If there are too many liberties the list is 279 270 truncated. … … 281 272 @item A list of the neighbor strings. 282 273 @end itemize 283 274 284 The basic data structure is275 The basic data structures are 285 276 286 277 @example 287 278 struct string_data @{ … … 290 281 int origin; /* Coordinates of "origin", i.e. */ 291 282 /* "upper left" stone. */ 292 283 int liberties; /* Number of liberties. */ 293 int libs[MAX_LIBERTIES]; /* Coordinates of liberties. */294 284 int neighbors; /* Number of neighbor strings */ 295 int neighborlist[MAXCHAIN]; /* List of neighbor string numbers. */296 285 int mark; /* General purpose mark. */ 297 286 @}; 298 287 299 struct string_data string[MAX_STRINGS]; 288 struct string_liberties_data @{ 289 int list[MAX_LIBERTIES]; /* Coordinates of liberties. */ 290 @}; 291 292 struct string_neighbors_data @{ 293 int list[MAXCHAIN]; /* List of neighbor string numbers. */ 294 @}; 295 296 static struct string_data string[MAX_STRINGS]; 297 static struct string_liberties_data string_libs[MAX_STRINGS]; 298 static struct string_neighbors_data string_neighbors[MAX_STRINGS]; 300 299 @end example 301 300 302 It should be clear that almost all information is stored in the 303 @code{string} array. To get a mapping from the board coordinates to the 304 @code{string} array we have 301 It should be clear that almost all information is stored in these 302 arrays. They are splitted because of caching purposes - if one doesn't 303 need libs or neighbors, accessing string_data is faster, because @code{list} 304 arrays are quite big. 305 306 To get a mapping from the board coordinates to these arrays we have 305 307 306 308 @example 307 309 static int string_number[BOARDMAX]; 308 310 @end example 309 311 310 312 @noindent 311 which contains indices into the @code{string} array. This information is only313 which contains indices into these arrays. This information is only 312 314 valid at nonempty vertices, however, so it is necessary to first 313 315 verify that @code{board[pos] != EMPTY}. 314 316 315 The @code{string_data} structure does not include an array of the stone 316 coordinates. This information is stored in a separate array: 317 A string stones coordinates are stored in a separate array: 317 318 318 319 @example 319 320 static int next_stone[BOARDMAX]; … … 335 336 static int liberty_mark; 336 337 static int string_mark; 337 338 static int next_string; 338 static int strings_initialized = 0;339 339 @end example 340 340 341 341 The @code{ml} array and @code{liberty_mark} are used to "mark" liberties on … … 349 349 individual strings. 350 350 351 351 @code{next_string} gives the number of the next available entry in the 352 @code{string} array. Then @code{strings_initialized} is set to one when 353 all data structures are known to be up to date. Given an arbitrary board 354 position in the @samp{board} array, this is done by calling 355 @code{incremental_board_init()}. It is not necessary to call this 356 function explicitly since any other function that needs the information 357 does this if it has not been done. 352 @code{string} array. 353 354 To initialize all the structures of the incremental board one need to 355 call @code{new_position} function, which builds all information based 356 on the actual state of the board (in @code{board} variable). 358 357 359 358 The interesting part of the code is the incremental update of the data 360 359 structures when a stone is played and subsequently removed. To 361 360 understand the strategies involved in adding a stone it is necessary 362 361 to first know how undoing a move works. The idea is that as soon as 363 some piece of information is about to be changed, the old value is 364 pushed onto a stack which stores the value and its address. The stack 365 is built from the following structures: 362 some piece of information is about to be changed, the old value (or 363 an intersection state) is pushed onto a stack which stores the value 364 and its address. The stack is built from the following structures (we 365 have two stacks really, because Intersection can have different type 366 than int): 366 367 367 368 @example 368 369 struct change_stack_entry @{ … … 370 371 int value; 371 372 @}; 372 373 373 struct change_stack_entry change_stack[STACK_SIZE]; 374 int change_stack_index; 374 struct vertex_stack_entry @{ 375 Intersection *address; 376 int value; 377 @}; 378 379 static struct change_stack_entry change_stack[STACK_SIZE]; 380 static struct change_stack_entry *change_stack_pointer; 381 382 static struct vertex_stack_entry vertex_stack[STACK_SIZE]; 383 static struct vertex_stack_entry *vertex_stack_pointer; 375 384 @end example 376 385 377 386 @noindent 378 387 and manipulated with the macros 379 388 380 389 @example 390 CLEAR_STACKS() 381 391 BEGIN_CHANGE_RECORD() 382 392 PUSH_VALUE(v) 393 PUSH_VERTEX(v) 383 394 POP_MOVE() 384 395 @end example 385 396 386 397 Calling @code{BEGIN_CHANGE_RECORD()} stores a null pointer in the address 387 398 field to indicate the start of changes for a new move. As mentioned 388 earlier @code{PUSH_VALUE()} stores a value and its corresponding address. 399 earlier @code{PUSH_VALUE()} and @code{PUSH_VERTEX()} stores a value and its 400 corresponding address. 389 401 Assuming that all changed information has been duly pushed onto the 390 402 stack, undoing the move is only a matter of calling @code{POP_MOVE()}, 391 403 which simply assigns the values to the addresses in the reverse order 392 until the null pointer is reached. This description is slightly 393 simplified because this stack can only store 'int' values and we need 394 to also store changes to the board. Thus we have two parallel stacks 395 where one stores @code{int} values and the other one stores 396 @code{Intersection} values. 404 until the null pointer is reached. 397 405 398 406 When a new stone is played on the board, first captured opponent 399 407 strings, if any, are removed. In this step we have to push the board … … 438 446 The often used construction 439 447 440 448 @example 441 pos = FIRST_STONE(s); 449 first_stone = FIRST_STONE(s); 450 pos = first_stone; 442 451 do @{ 443 452 ... 444 453 pos = NEXT_STONE(pos); 445 @} while ( !BACK_TO_FIRST_STONE(s, pos));454 @} while (pos != first_stone); 446 455 @end example 447 456 448 457 @noindent 449 458 traverses the stones of the string with number @samp{s} exactly once, 450 459 with @code{pos} holding the coordinates. In general @code{pos} is 451 460 used as board coordinate and @samp{s} as an index into the 452 @code{string} array or sometimes a pointer to an entry in the 453 @code{string} array. 461 @code{string}, @code{string_libs} or @code{string_neighbors} array. 454 462 455 463 @node Some Board Functions 456 464 @section Some Board Functions … … 489 497 the komaster scheme (@pxref{Ko}). 490 498 491 499 @itemize @bullet 492 @item @code{int trymove(int pos, int color, const char *message )}500 @item @code{int trymove(int pos, int color, const char *message, int str)} 493 501 @findex trymove 494 502 @quotation 495 503 Returns true if @code{(pos)} is a legal move for @code{color}. In that … … 498 506 with @option{--decide-string} or with @option{-o}), the string 499 507 @code{*message} will be inserted in the SGF file as a comment. The 500 508 comment will also refer to the string at @code{str} if this is not 501 @code{0}. The value of @code{str} can be NO_MOVE if it is not needed but 502 otherwise the location of @code{str} is included in the comment. 509 @code{NO_MOVE}. The value of @code{str} can be @code{NO_MOVE} if it is 510 not needed but otherwise the location of @code{str} is included in the 511 comment. @strong{NOTE}: including str in comment isn't implemented for 512 now 503 513 @end quotation 504 514 @item @code{int tryko(int pos, int color, const char *message)} 505 515 @findex tryko -
gnugo/doc/install.texi
RCS file: /sources/gnugo/gnugo/doc/install.texi,v retrieving revision 1.25 diff -u -r1.25 install.texi
130 130 @node Default Level 131 131 @subsection Default Level 132 132 133 GNU Go can play at different levels. Up to level 10 is 134 supported. At level 10 GNU Go is much more accurate but takes 135 an average of about 1.6 times longer to play than at level 8. 133 GNU Go can play at different levels. Level may be as high as you wish 134 but it will make GNU Go play slower (up to level 12 is recommended). At 135 level 10 GNU Go is much more accurate but takes an average of about 1.6 136 times longer to play than at level 8. 136 137 137 138 The level can be set at run time using the @option{--level} option. 138 139 If you don't set this, the default level will be used. You … … 146 147 @noindent 147 148 sets the default level to 9. If you omit this parameter, 148 149 the compiler sets the default level to 10. We recommend 149 using level 1 0unless you find it too slow. If you decide150 using level 12 unless you find it too slow. If you decide 150 151 you want to change the default you may rerun configure 151 152 and recompile the program. 152 153 … … 235 236 This is on by default. 236 237 @end itemize 237 238 239 There is one more option, which allows disabling of all unneeded 240 things in code - like stats, asserts, etc. It should be used only 241 to generate final release of the program and can be changed only 242 as configure option. 243 244 @itemize @bullet 245 @item @code{final-release} Disable unneeded things. 246 @end itemize 247 238 248 @node Windows and MS-DOS, Macintosh, Configure Options, Installation 239 249 @section Compiling GNU Go on Microsoft platforms 240 250 -
gnugo/doc/reading.texi
RCS file: /sources/gnugo/gnugo/doc/reading.texi,v retrieving revision 1.20 diff -u -r1.20 reading.texi
225 225 option @pxref{Invoking GNU Go}. 226 226 227 227 The hash table is created once and for all at the beginning of 228 the game by the function @code{ hashtable_new()}. Although hash228 the game by the function @code{reading_cache_init()}. Although hash 229 229 memory is thus allocated only once in the game, the table is 230 230 reinitialized at the beginning of each move by a call to 231 @code{ hashtable_clear()} from @code{genmove()}.231 @code{reading_cache_clear()} from @code{genmove()}. 232 232 233 233 @menu 234 234 * Hash Calculation:: Calculation of the hash value 235 235 * Hash Organization:: Organization of the hash table 236 * Hash Structures:: Structures in @file{hash.h}237 236 @end menu 238 237 239 238 @node Hash Calculation … … 249 248 @enumerate 250 249 @item First we define a @dfn{go position}. This positions consists of 251 250 @itemize @bullet 252 @item the actual board, i.e. the locations and colors of the stones 253 @item A @dfn{ko point}, if a ko is going on. The ko point is defined as251 @item the actual board, i.e. the locations and colors of the stones; 252 @item a @dfn{ko point}, if a ko is going on; the ko point is defined as 254 253 the empty point where the last single stone was situated before 255 254 it was captured. 256 255 @end itemize 257 256 257 In addition to that we include some more information into the hash code, 258 that describes stored analisys results: 259 @itemize @bullet 260 @item a @dfn{komaster} and @dfn{kom_pos}, @xref{Ko}, 261 @item an ID (an int between 0 and 255) of a function used to calculate 262 the results; 263 @item a target of analisys (up to two positions on a board); 264 @item sometimes some extra information used by various functions. 265 @end itemize 266 258 267 It is not necessary to specify the color to move (white or black) 259 268 as part of the position. The reason for this is that read results 260 269 are stored separately for the various reading functions such as 261 270 @code{attack3}, and it is implicit in the calling function which 262 271 player is to move. 263 272 264 @item For each location on the board we generate random numbers: 265 @itemize @bullet 266 @item A number which is used if there is a white stone on this location 267 @item A number which is used if there is a black stone on this location 268 @item A number which is used if there is a ko on this location 269 @end itemize 270 273 @item For each of the above information (excluding extra information) 274 we generate tables with random numbers for each: function, komaster 275 status or position on a board. 271 276 These random numbers are generated once at initialization time and 272 277 then used throughout the life time of the hash table. 273 278 274 279 @item The hash key for a position is the XOR of all the random numbers 275 which are applicable for the position (white stones, black stones, and 276 ko position). 280 which are applicable for the position. If extra information is needed 281 it is passed by a function as a hash code which is XORed into the 282 resulting hash key. 277 283 @end enumerate 278 284 279 285 @node Hash Organization 280 286 @subsection Organization of the hash table 281 287 282 The hash table consists of 3 parts:283 284 @cindex Hash node285 @cindex Read result286 287 @itemize @bullet288 @item An area which contains so called @dfn{Hash Nodes}. Each hash node289 contains:290 @itemize @minus291 @item A go position as defined above.292 @item A computed hash value for the position293 @item A pointer to Read Results (see below)294 @item A pointer to another hash node.295 @end itemize296 297 @item An area with so called Read Results. These are used to store298 which function was called in the go position, which string was299 under attack or to be defended, and the result of the reading.300 301 Each Read Result contains:302 @itemize @minus303 @item the function ID (an int between 0 and 255), the position of the304 string under attack and a depth value, which is used to305 determine how deep the search was when it was made, packed into306 one 32 bit integer.307 @item The result of the search (a numeric value) and a position to308 play to get the result packed into one 32 bit integer.309 @item A pointer to another Read Result.310 @end itemize311 312 @item An array of pointers to hash nodes. This is the hash table313 proper.314 315 @end itemize316 317 When the hash table is created, these 3 areas are allocated using318 @code{malloc()}. When the hash table is populated, all contents are taken319 from the Hash nodes and the Read results. No further allocation is320 done and when all nodes or results are used, the hash table is full.321 Nothing is deleted from the hash table except when it is totally322 emptied, at which point it can be used again as if newly initialized.323 324 @findex hashtable_search325 When a function wants to use the hash table, it looks up the current326 position using @code{hashtable_search()}. If the position doesn't already327 exist there, it can be entered using328 329 @findex hashtable_enter_position330 @code{hashtable_enter_position()}.331 332 @findex hashtable_enter_position333 Once the function has a pointer to the hash node containing a334 function, it can search for a result of a previous search using335 @code{hashnode_search()}. If a result is found, it can be used, and336 if not, a new result can be entered after a search using337 @findex hashnode_new_result338 @code{hashnode_new_result()}.339 340 Hash nodes which hash to the same position in the hash table341 (collisions) form a simple linked list. Read results for the same342 position, created by different functions and different attacked or343 defended strings also form a linked list.344 345 This is deemed sufficiently efficient for now, but the representation346 of collisions could be changed in the future. It is also not347 determined what the optimum sizes for the hash table, the number of348 positions and the number of results are.349 350 @node Hash Structures351 @subsection Hash Structures352 353 288 The basic hash structures are declared in @file{engine/hash.h} and 354 @file{engine/cache. c}289 @file{engine/cache.h} 355 290 356 @example 357 typedef struct hashposition_t @{ 358 Compacttype board[COMPACT_BOARD_SIZE]; 359 int ko_pos; 360 @} Hashposition; 361 @end example 362 363 Represents the board and optionally the location of a ko, 364 which is an illegal move. The player whose move is next 365 is not recorded. 291 The hash table consists of an array of pointers to hash entries and 292 variable that defines number of the entries. 366 293 367 294 @example 368 295 typedef struct @{ 369 Hashvalue hashval; 370 Hashposition hashpos; 371 @} Hash_data; 372 @end example 296 unsigned int num_entries; 297 Hashentry *entries; 298 @} Transposition_table; 373 299 374 Represents the return value of a function (@code{hashval}) and 375 the board state (@code{hashpos}). 376 377 @example 378 typedef struct read_result_t @{ 379 unsigned int data1; 380 unsigned int data2; 381 382 struct read_result_t *next; 383 @} Read_result; 300 Transposition_table ttable; 384 301 @end example 385 302 386 The data1 field packs into 32 bits the following fields: 387 388 @example 303 @cindex Hash entry 389 304 390 komaster: 2 bits (EMPTY, BLACK, WHITE, or GRAY) 391 kom_pos : 10 bits (allows MAX_BOARD up to 31) 392 routine : 4 bits (currently 10 different choices) 393 str1 : 10 bits 394 stackp : 5 bits 395 396 @end example 397 398 The data2 field packs into 32 bits the following fields: 305 The @dfn{Hash Entry} consists of two @dfn{Hash Nodes}. One is the 306 most reliable node and the second is the newest. The reliability is 307 computed based on cost of the function, which created a node and 308 depth of analysis for that node (the lower depth the more reliable 309 results). 399 310 400 311 @example 401 402 status : 2 bits (0 free, 1 open, 2 closed) 403 result1: 4 bits 404 result2: 4 bits 405 move : 10 bits 406 str2 : 10 bits 407 312 typedef struct @{ 313 Hashnode most_reliable; 314 Hashnode newest; 315 @} Hashentry; 408 316 @end example 409 317 410 The @code{komaster} and @code{(kom_pos)} field are 411 documented in @xref{Ko}. 318 @cindex Hash node 412 319 413 When a new result node is created, 'status' is set to 1 'open'. 414 This is then set to 2 'closed' when the result is entered. The main 415 use for this is to identify open result nodes when the hashtable is 416 partially cleared. Another potential use for this field is to 417 identify repeated positions in the reading, in particular local 418 double or triple kos. 320 Each hash node contains a computed hash value (as defined above) 321 and @dfn{Read Results}. 419 322 420 323 @example 421 typedef struct hashnode_t @{ 422 Hash_data key; 423 Read_result * results; 424 struct hashnode_t * next; 324 typedef struct @{ 325 Hash_data key; 326 HASHNODE_DATATYPE data; /* 32-bit value */ 425 327 @} Hashnode; 426 328 @end example 427 329 428 The hash table consists of hash nodes. Each hash node consists of 429 The hash value for the position it holds, the position itself and 430 the actual information which is purpose of the table from the start. 330 @cindex Read result 431 331 432 There is also a pointer to another hash node which is used when 433 the nodes are sorted into hash buckets (see below). 332 Read Results are used to store which function was called in the go 333 position, which string was under attack or to be defended, and the 334 result of the reading. The result is packed into one 32 bit integer. 335 Each Read Result contains: 336 @itemize @minus 337 @item a remaining (to the max depth) depth value, which is used to 338 determine how deep the search was when node was stored (5 bits); 339 @item the results of the search (two numeric values - 2 x 4 bits); 340 @item a cost of a function which stored the result (an arbitrary 341 numeric value) (4 bits); 342 @item a move to play to get the result (10 bits). 343 @end itemize 434 344 435 345 @example 436 typedef struct hashtable @{ 437 size_t hashtablesize; /* Number of hash buckets */ 438 Hashnode ** hashtable; /* Pointer to array of hashnode lists */ 346 #define hn_create_data(remaining_depth, value1, value2, move, cost) \ 347 ((((value1) & 0x0f) << 23) \ 348 | (((value2) & 0x0f) << 19) \ 349 | (((move) & 0x3ff) << 9) \ 350 | (((cost) & 0x0f) << 5) \ 351 | (((remaining_depth & 0x1f)/*<< 0*/))) 352 @end example 439 353 440 int num_nodes; /* Total number of hash nodes */ 441 Hashnode * all_nodes; /* Pointer to all allocated hash nodes. */ 442 int free_node; /* Index to next free node. */ 354 When the hash table is created, the hash entries are allocated using 355 @code{malloc()}. After that, no further allocation is 356 done and when all nodes or results are used, the hash table is full. 357 Nothing is deleted, instead nodes are replaced by newer or more 358 reliable nodes (when collision occurs). 443 359 444 int num_results; /* Total number of results */ 445 Read_result * all_results; /* Pointer to all allocated results. */ 446 int free_result; /* Index to next free result. */ 447 @} Hashtable; 448 @end example 360 @findex tt_get 361 When a function wants to use the hash table, it looks up the current 362 position using @code{tt_get()}. If the position doesn't already 363 exist there, it can be entered using 449 364 450 The hash table consists of three parts: 365 @findex tt_update 366 @code{tt_update()}. 451 367 452 @itemize @bullet 453 @item The hash table proper: a number of hash buckets with collisions 454 being handled by a linked list. 455 @item The hash nodes. These are allocated at creation time and are 456 never removed or reallocated in the current implementation. 457 @item The results of the searches. Since many different searches can 458 be done in the same position, there should be more of these than 459 hash nodes. 460 @end itemize 368 @findex tt_update 369 There are several macros which store the result and return it from 370 a searching functions. They are named @code{READ_RETURN0}, 371 @code{READ_RETURN}, @code{READ_RETURN_SEMEAI}, @code{READ_RETURN_CONN}, 372 @code{READ_RETURN_HASH} and @code{READ_RETURN2} and can be found in 373 @file{engine/cache.h}. 461 374 462 375 @node Persistent Cache 463 376 @section Persistent Reading Cache … … 610 523 611 524 The rationale behind this rule is that in the case where there are 612 525 two kos on the board, the komaster cannot win both, and by becoming 613 komaster he has already chosen which ko he wants to win . But in the614 case of a nested ko, taking one ko is a precondition to taking the 615 other one, so we allow this.526 komaster he has already chosen which ko he wants to win (the same reasoning 527 applies to WEAK_KO rule). But in the case of a nested ko, taking one ko is 528 a precondition to taking the other one, so we allow this. 616 529 617 530 If the komaster's opponent takes a ko, then both players have taken one ko. In 618 531 this case @code{komaster} is set to @code{GRAY_BLACK} or @code{GRAY_WHITE} and … … 628 541 @itemize @bullet 629 542 @item 1. Komaster is EMPTY. 630 543 @itemize @minus 631 @item 1a .Unconditional ko capture is allowed.544 @item 1a) Unconditional ko capture is allowed. 632 545 @quotation 633 546 Komaster remains EMPTY if previous move was not a ko capture. 634 547 Komaster is set to WEAK_KO if previous move was a ko capture … … 642 555 @end itemize 643 556 @item 2. Komaster is O: 644 557 @itemize @minus 645 @item 2a) Only nested ko captures are allowed. Kom_pos is moved to the 646 new removed stone. 647 @item 2b) If komaster fills the ko at kom_pos then komaster reverts to 648 EMPTY. 558 @item 2a) Only nested ko captures are allowed. 559 @quotation 560 Kom_pos is moved to the new removed stone. 561 @end quotation 562 @item 2b) If the ko has been resolved in favor of the komaster (when the ko 563 is filled or kom_pos is no longer a ko because of some capture) then the 564 komaster reverts to EMPTY. 649 565 @end itemize 650 566 @item 3. Komaster is X: 567 @itemize @minus 568 @item 569 Play at kom_pos is not allowed if it is the ko recapture. Any other ko capture 570 is allowed. 651 571 @quotation 652 Play at kom_pos is not allowed. Any other ko capture 653 is allowed. If O takes another ko, komaster becomes GRAY_X. 572 If O takes another ko, komaster becomes GRAY_X. 654 573 @end quotation 574 @end itemize 655 575 @item 4. Komaster is GRAY_O or GRAY_X: 656 @quotation 657 Ko captures are not allowed. If the ko at kom_pos is 658 filled then the komaster reverts to EMPTY. 659 @end quotation 576 @itemize @minus 577 @item 578 Ko captures are not allowed. If the ko has been resolved in favor of 579 the komaster (when the ko is filled or kom_pos is no longer a ko because 580 of some capture) then the komaster reverts to EMPTY. 581 @end itemize 660 582 @item 5. Komaster is WEAK_KO: 661 583 @itemize @minus 662 584 @item 5a) After a non-ko move komaster reverts to EMPTY. 663 585 @item 5b) Unconditional ko capture is only allowed if it is nested ko capture. 664 586 @quotation 665 Komaster is changed to WEAK_X and kom_pos to the old value of 666 board_ko_pos. 587 Kom_pos is moved to the old value of board_ko_pos. 667 588 @end quotation 668 589 @item 5c) Conditional ko capture is allowed according to the rules of 1b. 669 590 @end itemize … … 801 722 The correct resolution is that H1 attacks L1 unconditionally while K2 802 723 defends it with ko (code @code{KO_A}). 803 724 804 After Black (X) takes the ko at K 3, white can do nothing725 After Black (X) takes the ko at K2, white can do nothing 805 726 but retake the ko conditionally, becoming komaster. B cannot 806 727 do much, but in one variation he plays at K4 and W takes 807 728 at H1. The following position results: … … 821 742 @end example 822 743 823 744 Now it is important the @samp{O} is no longer komaster. Were @samp{O} 824 still komaster, he could capture the ko at N3 and there would be745 still komaster, he couldn't capture the ko at N3 and there would be 825 746 no way to finish off B. 826 747 827 748 -
gnugo/doc/using.texi
RCS file: /sources/gnugo/gnugo/doc/using.texi,v retrieving revision 1.31 diff -u -r1.31 using.texi
496 496 Use Japanese Rules. This is the default unless you specify 497 497 @option{--enable-chinese-rules} as a configure option. 498 498 @end quotation 499 @item @option{--autolevel} 500 @quotation 501 Turns on level adjusting according to the left time. It doesn't apply to 502 GTP mode (which is turned on by GTP commands). 503 @end quotation 504 @item @option{--min-level @var{amount}} 505 @quotation 506 If the time is running out, sets the minimum level with which GNU Go 507 will play. If lower level is set with --level option, it sets 508 --min-level to that lower value too. Used only when --autolevel is 509 turned on. 510 @end quotation 511 @item @option{--max-level @var{amount}} 512 @quotation 513 If much time is left, sets the maximum level with which GNU Go will 514 play. If higher level is set with --level option, it sets --max-level 515 to that higher value too. Used only when --autolevel is turned on. 516 @end quotation 499 517 @item @option{--forbid-suicide} 500 518 @quotation 501 519 Do not allow suicide moves (playing a stone so that it ends up without … … 582 600 accuracy. For completeness, here they are. 583 601 584 602 @itemize @bullet 603 @item @option{--print-levels} 604 @quotation 605 Prints info about each level of play of GNU Go. 606 @end quotation 607 @end itemize 608 609 @itemize @bullet 585 610 @item @option{-D}, @option{--depth @var{depth}} 586 611 @cindex depth 587 612 @quotation … … 621 646 depth (default 13), GNU Go still tries to attack strings with only 622 647 3 liberties, but only tries one move at each node. 623 648 @end quotation 624 @item @option{--break_chain- cutoff@var{depth}}649 @item @option{--break_chain-depth @var{depth}} 625 650 @quotation 626 651 Set the @code{break_chain_depth}. Beyond this depth, GNU Go abandons 627 652 some attempts to defend groups by trying to capture part of the surrounding … … 643 668 Such tactics are tried below @code{superstring_depth} and this 644 669 command line option allows this parameter to be set. 645 670 @end quotation 671 @item @option{--semeai-node-limit @var{n}} 672 @quotation 673 If the number of variations exceeds this limit, Owl stops analyzing 674 semeai moves. Default 500. 675 @end quotation 646 676 @end itemize 647 677 648 678 The preceeding options are documented with the reading code … … 724 754 GNU Go. It causes both the traces and the output file (@option{-o}) to 725 755 be more informative. 726 756 @end quotation 757 @item @option{--limit-search @var{location}} 758 @quotation 759 Limits the area of allowed moves to a diamond with radius 6 with center 760 at @var{location}. 761 @end quotation 727 762 @item @option{-T}, @option{--printboard}: colored display of dragons. 728 763 @quotation 729 764 Use rxvt, xterm or Linux Console. (@pxref{Colored Display}) … … 732 767 @quotation 733 768 Print timing information to stderr. 734 769 @end quotation 770 @item @option{--showscore} 771 @quotation 772 Print scoring information to stderr. 773 @end quotation 735 774 @item @option{-E}, @option{--printeyes}: colored display of eye spaces 736 775 @quotation 737 776 Use rxvt, xterm or Linux Console. (@pxref{Colored Display}) … … 799 838 @quotation 800 839 Print statistics (for debugging purposes). 801 840 @end quotation 841 @item @option{--profile-patterns} 842 @quotation 843 Print statistics for pattern usage. 844 @end quotation 802 845 @item @option{-t}, @option{--trace} 803 846 @quotation 804 847 Print debugging information. Use twice for more detail. … … 919 962 The option @option{--capture-all-dead} requires the aftermath 920 963 code to finish capturing all dead stones. 921 964 @end quotation 965 @item @option{--play-out-aftermath} 966 @quotation 967 Forces playing of aftermath (see --score). 968 @end quotation 922 969 @end itemize 923 970 924 971 @subsection Experimental options -
gnugo/doc/utils.texi
RCS file: /sources/gnugo/gnugo/doc/utils.texi,v retrieving revision 1.19 diff -u -r1.19 utils.texi
514 514 @item @code{void dump_stack(void)} 515 515 @findex dump_stack 516 516 @quotation 517 for use under GDB prints the move stack. 517 For use under GDB prints the move stack. 518 @end quotation 519 @item @code{void dump_incremental_board(void)} 520 @findex dump_incremental_board 521 @quotation 522 Debug function. Dump all incremental board information. 518 523 @end quotation 519 524 @item @code{void add_stone(int pos, int color)} 520 525 @findex add_stone … … 588 593 different functions in this family. 589 594 590 595 @itemize @bullet 591 @item @code{int countlib(int str )}596 @item @code{int countlib(int str_pos)} 592 597 @findex countlib 593 598 @quotation 594 Count the number of liberties of the string at @code{ pos}. There595 must be a stone at this location.599 Count the number of liberties of the string at @code{str_pos}. @code{str_pos} 600 must not be empty. 596 601 @end quotation 597 @item @code{int findlib(int str , int maxlib, int *libs)}602 @item @code{int findlib(int str_pos, int maxlib, int *libs)} 598 603 @findex findlib 599 604 @quotation 600 Find the liberties of the string at @code{str}. This location must not be 601 empty. The locations of up to maxlib liberties are written into 602 @code{libs[]}. The full number of liberties is returned. If you want the 603 locations of all liberties, whatever their number, you should pass 604 @code{MAXLIBS} as the value for @code{maxlib} and allocate space for 605 @code{libs[]} accordingly. 605 Find the liberties of the string at @code{str_pos}. @code{str_pos} must not be 606 empty. The locations of up to maxlib liberties are written into @code{libs[]}. 607 The full number of liberties is returned. If you want the locations of all 608 liberties, whatever their number, you should pass @code{MAXLIBS} as the value 609 for @code{maxlib} and allocate space for @code{libs[]} accordingly. 606 610 @end quotation 607 611 @item @code{int fastlib(int pos, int color, int ignore_captures)} 608 612 @findex fastlib … … 652 656 Next we have some general utility functions. 653 657 654 658 @itemize @bullet 655 @item @code{int count_common_libs(int str1 , int str2)}659 @item @code{int count_common_libs(int str1_pos, int str2_pos)} 656 660 @findex count_common_libs 657 661 @quotation 658 662 Find the number of common liberties of the two strings. 659 663 @end quotation 660 @item @code{int find_common_libs(int str1 , int str2, int maxlib, int *libs)}664 @item @code{int find_common_libs(int str1_pos, int str2_pos, int maxlib, int *libs)} 661 665 @findex find_common_libs 662 666 @quotation 663 667 Find the common liberties of the two strings. The locations of up to … … 666 670 common liberties, whatever their number, you should pass @code{MAXLIBS} as the 667 671 value for @code{maxlib} and allocate space for @code{libs[]} accordingly. 668 672 @end quotation 669 @item @code{int have_common_lib(int str1 , int str2, int *lib)}673 @item @code{int have_common_lib(int str1_pos, int str2_pos, int *lib)} 670 674 @findex have_common_lib 671 675 @quotation 672 676 Determine whether two strings have at least one common liberty. 673 677 If they do and @code{lib != NULL}, one common liberty is returned in 674 678 @code{*lib}. 675 679 @end quotation 676 @item @code{int countstones(int str )}680 @item @code{int countstones(int str_pos)} 677 681 @findex countstones 678 682 @quotation 679 683 Report the number of stones in a string. 680 684 @end quotation 681 @item @code{int findstones(int str, int maxstones, int *stones)} 685 @item @code{int count_adjacent_stones(int str1_pos, int str2_pos, int maxstones)} 686 @findex count_adjacent_stones 687 @quotation 688 Counts how many stones in one string are directly adjacent to the second 689 string. A limit can be given in the @code{maxstones} parameter so that the 690 function returns immediately. 691 @end quotation 692 @item @code{int findstones(int str_pos, int maxstones, int *stones)} 682 693 @findex findstones 683 694 @quotation 684 Find the stones of the string at @code{str }. The location must not be685 empty. The locations of up to maxstones stones are written into 686 @code{stones[]}. The full number ofstones is returned.695 Find the stones of the string at @code{str_pos}. The locations of up 696 to maxstones stones are written into @code{stones[]}. The full number of 697 stones is returned. 687 698 @end quotation 688 @item @code{int chainlinks(int str, int adj[MAXCHAIN])}699 @item @code{int chainlinks(int str_pos, int adj[MAXCHAIN])} 689 700 @findex chainlinks 690 701 @quotation 691 702 This very useful function returns (in the @code{adj} array) the chains 692 surrounding the string at @code{str }. The number of chains is returned.703 surrounding the string at @code{str_pos}. The number of chains is returned. 693 704 @end quotation 694 @item @code{int chainlinks2(int str , int adj[MAXCHAIN], int lib)}705 @item @code{int chainlinks2(int str_pos, int adj[MAXCHAIN], int lib)} 695 706 @findex chainlinks2 696 707 @quotation 697 708 Returns (in @code{adj} array) those chains surrounding the string at 698 @code{str }, which has exactly @code{lib} liberties. The number of such chains709 @code{str_pos}, which has exactly @code{lib} liberties. The number of such chains 699 710 is returned. 700 711 @end quotation 701 @item @code{int chainlinks3(int str , int adj[MAXCHAIN], int lib)}712 @item @code{int chainlinks3(int str_pos, int adj[MAXCHAIN], int lib)} 702 713 @findex chainlinks3 703 714 @quotation 704 715 Returns (in @code{adj} array) the chains surrounding 705 the string at @code{str }, which have less or equal @code{lib} liberties.716 the string at @code{str_pos}, which have less or equal @code{lib} liberties. 706 717 The number of such chains is returned. 707 718 @end quotation 708 @item @code{int extended_chainlinks(int str , int adj[MAXCHAIN], int both_colors)}719 @item @code{int extended_chainlinks(int str_pos, int adj[MAXCHAIN], int both_colors)} 709 720 @findex extended_chainlinks 710 721 @quotation 711 722 Returns (in the @code{adj} array) the opponent strings being directly adjacent 712 to @code{str} or having a common liberty with @code{str}. The number of such713 strings is returned. If the both_colors parameter is true, also own strings723 to string at @code{str_pos} or having a common liberty with @code{str_nr}. The number 724 of such strings is returned. If the both_colors parameter is true, also own strings 714 725 sharing a liberty are returned. 715 726 @end quotation 716 @item @code{int find_origin(int str )}727 @item @code{int find_origin(int str_pos)} 717 728 @findex find_origin 718 729 @quotation 719 730 Find the origin of a string, i.e. the point with the smallest 1D board … … 727 738 i.e. whether it would get more than one liberty. This function 728 739 returns true also for the case of a suicide move. 729 740 @end quotation 730 @item @code{int liberty_of_string(int pos, int str )}741 @item @code{int liberty_of_string(int pos, int str_pos)} 731 742 @findex liberty_of_string 732 743 @quotation 733 Returns true if @code{pos} is a liberty of the string at @code{str}. 744 Returns true if @code{pos} is a liberty of the string at @code{str_pos}. Checks 745 whether pos is a liberty. 746 @end quotation 747 @item @code{int liberty_of_string2(int pos, int str_pos)} 748 @findex liberty_of_string2 749 @quotation 750 Returns true if @code{pos} is a liberty of the string at @code{str_pos}. 751 @code{str_pos} must be a liberty. 734 752 @end quotation 735 @item @code{int second_order_liberty_of_string(int pos, int str )}753 @item @code{int second_order_liberty_of_string(int pos, int str_pos)} 736 754 @findex second_order_liberty_of_string 737 755 @quotation 738 Returns true if @code{pos} is a second order liberty of the string at str. 756 Returns true if @code{pos} is a second order liberty of the string at 757 @code{str_pos}. 739 758 @end quotation 740 @item @code{int neighbor_of_string(int pos, int str)} 759 @item @code{int are_neighbors(int pos1, int pos2)} 760 @findex are_neighbors 761 @quotation 762 Returns true if the empty vertex or the string at @code{pos1} is 763 adjacent to the empty vertex or the string at @code{pos2}. 764 @end quotation 765 @item @code{int neighbor_of_string(int pos, int str_pos)} 741 766 @findex neighbor_of_string 742 767 @quotation 743 Returns true if @code{pos} is adjacent to the string at @code{str }.768 Returns true if @code{pos} is adjacent to the string at @code{str_pos}. 744 769 @end quotation 745 770 @item @code{int has_neighbor(int pos, int color)} 746 771 @findex has_neighbor 747 772 @quotation 748 773 Returns true if @code{pos} has a neighbor of @code{color}. 749 774 @end quotation 750 @item @code{int same_string(int str1 , int str2)}775 @item @code{int same_string(int str1_pos, int str2_pos)} 751 776 @findex same_string 752 777 @quotation 753 Returns true if @code{str1 } and @code{str2} belong to the same string.778 Returns true if @code{str1_pos} and @code{str2_pos} belong to the same string. 754 779 @end quotation 755 @item @code{int adjacent_strings(int str1 , int str2)}780 @item @code{int adjacent_strings(int str1_pos, int str2_pos)} 756 781 @findex adjacent_strings 757 782 @quotation 758 Returns true if the strings at @code{str1 } and @code{str2} are adjacent.783 Returns true if the strings at @code{str1_pos} and @code{str2_pos} are adjacent. 759 784 @end quotation 760 785 @item @code{int is_ko(int pos, int color, int *ko_pos)} 761 786 @findex is_ko … … 777 802 Return true if @code{pos} is either a stone, which if captured would give 778 803 ko, or if @code{pos} is an empty intersection adjacent to a ko stone. 779 804 @end quotation 805 @item @code{int is_superko_violation(int pos, int color, enum ko_rules type)} 806 @findex is_superko_violation 807 @quotation 808 Return true if a move by @code{color} at @code{pos} is a superko violation 809 according to the specified type of ko rules. This function does not 810 detect simple ko unless it's also a superko violation. 811 @end quotation 780 812 @item @code{int does_capture_something(int pos, int color)} 781 813 @findex does_capture_something 782 814 @quotation … … 797 829 Returns true if at least one move has been played at pos 798 830 at deeper than level @code{cutoff} in the reading tree. 799 831 @end quotation 832 @item @code{void get_move_from_stack(int k, int *move, int *color)} 833 @findex get_move_from_stack 834 @quotation 835 Retrieve a move from the move stack. 836 @end quotation 800 837 @item @code{int stones_on_board(int color)} 801 838 @findex stones_on_board 802 839 @quotation
