Ticket #180: draqo-doc.diff

File draqo-doc.diff, 73.7 KB (added by arend, 3 years ago)
  • doc/board.texi

    RCS file: /home/arend/Go/gnugo-rsync/gnugo/doc/board.texi,v
    retrieving revision 1.15
    diff -u -p -r1.15 board.texi
     
    7171@group 
    7272 
    7373int           board_size; 
    74 Intersection  board[MAXSIZE]; 
     74Intersection  board[BOARDSIZE]; 
    7575int           board_ko_pos; 
    7676 
    7777float         komi; 
    7878int           white_captured; 
    7979int           black_captured; 
    8080 
    81 Hash_data     hashdata; 
     81Hash_data     board_hash; 
    8282@end group 
    8383@end example 
    8484 
    85 The description of the @code{Position} struct is applicable to these 
     85The description of the @code{board_state} struct is applicable to these 
    8686variables also, so we won't duplicate it here.  All these variables are 
    8787globals for performance reasons.  Behind these variables, there are a 
    8888number of other private data structures.  These implement incremental 
    8989handling of strings, liberties and other properties  
    90 (@pxref{Incremental Board}). The variable @code{hashdata} contains information 
     90(@pxref{Incremental Board}). The variable @code{board_hash} contains information 
    9191about the hash value for the current position (@pxref{Hashing}). 
    9292 
    9393These variables should never be manipulated directly, since they are 
     
    181181#define NS           (MAX_BOARD + 1) 
    182182#define WE           1 
    183183#define SOUTH(pos)   ((pos) + NS) 
    184 #define WEST(pos)    ((pos) - 1) 
     184#define WEST(pos)    ((pos) - WE) 
    185185#define NORTH(pos)   ((pos) - NS) 
    186 #define EAST(pos)    ((pos) + 1) 
     186#define EAST(pos)    ((pos) + WE) 
    187187@end example 
    188188 
    189189There are also shorthand macros @code{SW}, @code{NW}, @code{NE}, 
     
    209209often one computation is sufficient for 1D-coordinate where we would need 
    210210two with two 2D-coordinates: If we, for example, want to have the 
    211211coordinate of the upper right of @code{pos}, we can do this with 
    212 @code{NORTH(EAST(pos))} instead of @code{(i+1, j-1)}. 
     212@code{NE(pos)} instead of @code{(i+1, j-1)}. 
    213213 
    214214@strong{Important}: The 2D coordinate @code{(-1,-1)}, which is used for 
    215215pass and sometimes to indicate no point, maps to the 1D coordinate 
     
    240240a point on the board.  
    241241 
    242242Often 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: 
     243at every vertex. Here are the best way of doing this (other 
     244implemantations were tested and are slower on 19x19 board): 
    254245 
    255246@example 
    256247  int pos; 
     
    273264@item Number of stones in the string. 
    274265@item Origin of the string, i.e. a canonical reference point, defined 
    275266to 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). 
    277268@item Number of liberties. 
    278269@item A list of the liberties. If there are too many liberties the list is 
    279270truncated. 
     
    281272@item A list of the neighbor strings. 
    282273@end itemize 
    283274 
    284 The basic data structure is 
     275The basic data structures are 
    285276 
    286277@example 
    287278struct string_data @{ 
     
    290281  int origin;                      /* Coordinates of "origin", i.e. */ 
    291282                                   /* "upper left" stone. */ 
    292283  int liberties;                   /* Number of liberties. */ 
    293   int libs[MAX_LIBERTIES];         /* Coordinates of liberties. */ 
    294284  int neighbors;                   /* Number of neighbor strings */ 
    295   int neighborlist[MAXCHAIN];      /* List of neighbor string numbers. */ 
    296285  int mark;                        /* General purpose mark. */ 
    297286@}; 
    298287 
    299 struct string_data string[MAX_STRINGS]; 
     288struct string_liberties_data @{ 
     289  int list[MAX_LIBERTIES];         /* Coordinates of liberties. */ 
     290@}; 
     291 
     292struct string_neighbors_data @{ 
     293  int list[MAXCHAIN];              /* List of neighbor string numbers. */ 
     294@}; 
     295 
     296static struct string_data string[MAX_STRINGS]; 
     297static struct string_liberties_data string_libs[MAX_STRINGS]; 
     298static struct string_neighbors_data string_neighbors[MAX_STRINGS]; 
    300299@end example 
    301300 
    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 
     301It should be clear that almost all information is stored in these 
     302arrays. They are splitted because of caching purposes - if one doesn't 
     303need libs or neighbors, accessing string_data is faster, because @code{list} 
     304arrays are quite big. 
     305 
     306To get a mapping from the board coordinates to these arrays we have 
    305307 
    306308@example 
    307309static int string_number[BOARDMAX]; 
    308310@end example 
    309311 
    310312@noindent 
    311 which contains indices into the @code{string} array. This information is only 
     313which contains indices into these arrays. This information is only 
    312314valid at nonempty vertices, however, so it is necessary to first 
    313315verify that @code{board[pos] != EMPTY}. 
    314316 
    315 The @code{string_data} structure does not include an array of the stone 
    316 coordinates. This information is stored in a separate array: 
     317A string stones coordinates are stored in a separate array: 
    317318 
    318319@example 
    319320static int next_stone[BOARDMAX]; 
     
    335336static int liberty_mark; 
    336337static int string_mark; 
    337338static int next_string; 
    338 static int strings_initialized = 0; 
    339339@end example 
    340340 
    341341The @code{ml} array and @code{liberty_mark} are used to "mark" liberties on 
     
    349349individual strings. 
    350350 
    351351@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 
     354To initialize all the structures of the incremental board one need to 
     355call @code{new_position} function, which builds all information based 
     356on the actual state of the board (in @code{board} variable). 
    358357 
    359358The interesting part of the code is the incremental update of the data 
    360359structures when a stone is played and subsequently removed. To 
    361360understand the strategies involved in adding a stone it is necessary 
    362361to 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: 
     362some piece of information is about to be changed, the old value (or 
     363an intersection state) is pushed onto a stack which stores the value 
     364and its address. The stack is built from the following structures (we 
     365have two stacks really, because Intersection can have different type 
     366than int): 
    366367 
    367368@example 
    368369struct change_stack_entry @{ 
     
    370371  int value; 
    371372@}; 
    372373 
    373 struct change_stack_entry change_stack[STACK_SIZE]; 
    374 int change_stack_index; 
     374struct vertex_stack_entry @{ 
     375  Intersection *address; 
     376  int value; 
     377@}; 
     378 
     379static struct change_stack_entry change_stack[STACK_SIZE]; 
     380static struct change_stack_entry *change_stack_pointer; 
     381 
     382static struct vertex_stack_entry vertex_stack[STACK_SIZE]; 
     383static struct vertex_stack_entry *vertex_stack_pointer; 
    375384@end example 
    376385 
    377386@noindent 
    378387and manipulated with the macros 
    379388 
    380389@example 
     390CLEAR_STACKS() 
    381391BEGIN_CHANGE_RECORD() 
    382392PUSH_VALUE(v) 
     393PUSH_VERTEX(v) 
    383394POP_MOVE() 
    384395@end example 
    385396 
    386397Calling @code{BEGIN_CHANGE_RECORD()} stores a null pointer in the address 
    387398field to indicate the start of changes for a new move. As mentioned 
    388 earlier @code{PUSH_VALUE()} stores a value and its corresponding address. 
     399earlier @code{PUSH_VALUE()} and @code{PUSH_VERTEX()} stores a value and its 
     400corresponding address. 
    389401Assuming that all changed information has been duly pushed onto the 
    390402stack, undoing the move is only a matter of calling @code{POP_MOVE()}, 
    391403which 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. 
     404until the null pointer is reached. 
    397405 
    398406When a new stone is played on the board, first captured opponent 
    399407strings, if any, are removed. In this step we have to push the board 
     
    438446The often used construction 
    439447 
    440448@example 
    441     pos = FIRST_STONE(s); 
     449    first_stone = FIRST_STONE(s); 
     450    pos = first_stone; 
    442451    do @{ 
    443452        ... 
    444453        pos = NEXT_STONE(pos); 
    445     @} while (!BACK_TO_FIRST_STONE(s, pos)); 
     454    @} while (pos != first_stone); 
    446455@end example 
    447456 
    448457@noindent 
    449458traverses the stones of the string with number @samp{s} exactly once, 
    450459with @code{pos} holding the coordinates. In general @code{pos} is 
    451460used 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. 
    454462 
    455463@node Some Board Functions 
    456464@section Some Board Functions 
     
    489497the komaster scheme (@pxref{Ko}). 
    490498 
    491499@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)} 
    493501@findex trymove 
    494502@quotation 
    495503Returns true if @code{(pos)} is a legal move for @code{color}. In that 
     
    498506with @option{--decide-string} or with @option{-o}), the string 
    499507@code{*message} will be inserted in the SGF file as a comment. The 
    500508comment 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 
     510not needed but otherwise the location of @code{str} is included in the 
     511comment. @strong{NOTE}: including str in comment isn't implemented for 
     512now 
    503513@end quotation 
    504514@item @code{int tryko(int pos, int color, const char *message)} 
    505515@findex tryko 
  • doc/dfa.texi

    RCS file: /home/arend/Go/gnugo-rsync/gnugo/doc/dfa.texi,v
    retrieving revision 1.7
    diff -u -p -r1.7 dfa.texi
     
    11In this chapter, we describe the principles of the GNU Go DFA 
    22pattern matcher.  The aim of this system is to permit a fast 
    3 pattern matching when it becomes time critical like in owl 
    4 module (@ref{The Owl Code}). Since GNU Go 3.2, this is enabled 
     3pattern matching. Since GNU Go 3.2, this is enabled 
    54by default. You can still get back the traditional pattern matcher 
    65by running @command{configure --disable-dfa} and then recompiling 
    76GNU Go.  
  • doc/dragon.texi

    RCS file: /home/arend/Go/gnugo-rsync/gnugo/doc/dragon.texi,v
    retrieving revision 1.19
    diff -u -p -r1.19 dragon.texi
     
    1717Later routines called by @code{genmove()} will then have access to this 
    1818information. This document attempts to explain the philosophy and 
    1919algorithms of this preliminary analysis, which is carried out by the 
    20 two routines @code{make_worm()} and @code{make_dragon()} in  
    21 @file{dragon.c}. 
     20two routines @code{make_worms()} (in @file{worm.c}) and 
     21@code{make_dragons()} (in @file{dragon.c}). 
    2222 
    2323@cindex dragon 
    2424@cindex worm 
     
    8383  int unconditional_status; 
    8484  int attack_points[MAX_TACTICAL_POINTS]; 
    8585  int attack_codes[MAX_TACTICAL_POINTS]; 
     86  int discarded_attacks[MAX_TACTICAL_POINTS]; 
    8687  int defense_points[MAX_TACTICAL_POINTS]; 
    8788  int defend_codes[MAX_TACTICAL_POINTS]; 
     89  int discarded_defenses[MAX_TACTICAL_POINTS]; 
    8890  int attack_threat_points[MAX_TACTICAL_POINTS]; 
    89   int attack_threat_codes[MAX_TACTICAL_POINTS];  
     91  int attack_threat_codes[MAX_TACTICAL_POINTS]; 
     92  int discarded_att_threats[MAX_TACTICAL_POINTS]; 
    9093  int defense_threat_points[MAX_TACTICAL_POINTS]; 
    9194  int defense_threat_codes[MAX_TACTICAL_POINTS]; 
     95  int discarded_def_threats[MAX_TACTICAL_POINTS]; 
    9296@}; 
    9397@end example 
    9498 
     
    109113other worm. Intersections that are shared are counted with equal 
    110114fractional values for each worm. This measures the direct territorial 
    111115value of capturing a worm. @dfn{effective_size} is a floating point number. 
    112 Only intersections at a distance of 4 or less are counted. 
     116Only intersections at a distance (empty vertices between a worm and an 
     117intersection) of 5 or less are counted. 
    113118@end quotation 
    114119@item @code{origin} 
    115120@quotation 
     
    220225@end quotation 
    221226@item @code{cutstone2}  
    222227@quotation 
    223 Cutting points are identified by the patterns in the connections 
    224 database. Proper cuts are handled by the fact that attacking and 
     228Number of potential cuts involving the worm. Cutting points are 
     229identified by the patterns in the connections database. Proper 
     230cuts are handled by the fact that attacking and 
    225231defending moves also count as moves cutting or connecting the 
    226232surrounding dragons.  The @code{cutstone2} field is set during  
    227233@code{find_cuts()}, called from @code{make_domains()}. 
     
    248254opposite color can be killed. More precisely an 
    249255@dfn{inessential string} is a string S of genus zero, 
    250256not adjacent to any opponent string which can be easily 
    251 captured, and which has no edge liberties or second 
     257captured, which is not cutstone, and which has up to 
     2582 edge liberties and no second 
    252259order liberties, and which satisfies the following 
    253260further property: If the string is removed from the 
    254261board, then the remaining cavity only borders worms of the 
     
    266273even if the opponent is allowed an arbitrary number of consecutive 
    267274moves. 
    268275@end quotation 
    269 @item unconditional_status 
     276@item @code{unconditional_status} 
    270277@quotation 
    271278Unconditional status is also set by the function 
    272279@code{unconditional_life}. This is set @code{ALIVE} for stones which are 
     
    285292transformed into an invincible group by some number of consecutive 
    286293moves. Well, this is not entirely true because there is a rare class of 
    287294seki groups not satisfying this condition. Exactly which these are is 
    288 left as an exercise for the reader. Currently @code{unconditional_life}, 
    289 which strictly follows the definitions above, calls such seki groups 
    290 unconditionally dead, which of course is a misfeature. It is possible to 
    291 avoid this problem by making the algorithm slightly more complex, but 
    292 this is left for a later revision. 
     295shown in a comment in @file{unconditional.c}. 
    293296@end quotation 
    294 @item @code{int attack_points[MAX_TACTICAL_POINTS]} 
    295 @item @code{attack_codes[MAX_TACTICAL_POINTS]} 
     297@item @code{int attack_points[MAX_TACTICAL_POINTS];} 
     298@item @code{int attack_codes[MAX_TACTICAL_POINTS];} 
    296299@item @code{int defense_points[MAX_TACTICAL_POINTS];} 
    297300@item @code{int defend_codes[MAX_TACTICAL_POINTS];} 
    298301@quotation 
     
    310313@quotation 
    311314These are points that threaten to attack or defend a worm. 
    312315@end quotation 
     316@item @code{int discarded_attacks[MAX_TACTICAL_POINTS];} 
     317@item @code{int discarded_defenses[MAX_TACTICAL_POINTS];} 
     318@item @code{int discarded_att_threats[MAX_TACTICAL_POINTS];} 
     319@item @code{int discarded_def_threats[MAX_TACTICAL_POINTS];} 
     320@quotation 
     321These are checked points that haven't led to any positive result. 
     322Used to not check the same point more than once. 
     323@end quotation 
    313324@end itemize 
    314325 
    315326The function @code{makeworms()} will generate data for all worms. 
     
    343354XXX...        
    344355 
    345356@end example 
    346 @findex dragon_eye 
    347  
    348 The code for this type of amalgamation is in the routine 
    349 @code{dragon_eye()}, discussed further in EYES. 
    350357 
    351358Next, we amalgamate strings which seem uncuttable. We amalgamate dragons 
    352359which either share two or more common liberties, or share one liberty 
     
    367374@section Connection 
    368375@cindex connections 
    369376 
    370 The fields @code{black_eye.cut} and @code{white_eye.cut} are set where the 
     377The fields in @code{cutting_points} are set where the 
    371378opponent can cut, and this is done by the B (break) class patterns in 
    372 @file{conn.db}.  There are two important uses for this field, which can be 
     379@file{conn.db}.  There are two important uses for this table, which can be 
    373380accessed by the autohelper functions @code{xcut()} and @code{ocut()}. The 
    374381first use is to stop amalgamation in positions like 
    375382 
     
    534541  int safety; 
    535542  float weakness; 
    536543  float weakness_pre_owl; 
     544  float strategic_size; 
    537545  int escape_route; 
    538546  struct eyevalue genus; 
    539547  int heye; 
     
    541549  int surround_status; 
    542550  int surround_size; 
    543551  int semeais; 
    544   int semeai_margin_of_safety; 
     552  int semeai_defense_code; 
    545553  int semeai_defense_point; 
    546   int semeai_defense_certain;   
     554  int semeai_defense_certain; 
     555  int semeai_defense_target; 
     556  int semeai_attack_code; 
    547557  int semeai_attack_point; 
    548558  int semeai_attack_certain; 
     559  int semeai_attack_target; 
    549560  int owl_threat_status; 
    550561  int owl_status; 
    551562  int owl_attack_point; 
    552563  int owl_attack_code; 
    553564  int owl_attack_certain; 
     565  int owl_attack_node_count; 
    554566  int owl_second_attack_point; 
    555567  int owl_defense_point; 
    556568  int owl_defense_code; 
     
    607619@quotation 
    608620The dragon number, used as a key into the @code{dragon2} array. 
    609621@end quotation 
    610 @item origin 
     622@item @code{origin} 
    611623@cindex dragon origin 
    612624@quotation 
    613625The origin of the dragon is a unique particular vertex 
     
    616628copied to the dragon origins. Amalgamation of two dragons 
    617629amounts to changing the origin of one. 
    618630@end quotation 
    619 @item size 
     631@item @code{size} 
    620632@cindex dragon size 
    621633@quotation 
    622634The number of stones in the dragon. 
    623635@end quotation 
    624 @item effective size 
     636@item @code{effective size} 
    625637@cindex effective size 
    626638@quotation 
    627639The sum of the effective sizes of the constituent worms. 
     
    630642cardinality of the dragon plus the number of empty vertices which are 
    631643nearer this dragon than any other. 
    632644@end quotation 
    633 @item crude_status 
     645@item @code{crude_status} 
    634646@quotation 
    635647(ALIVE, DEAD, UNKNOWN, CRITICAL). An early measure of the life 
    636648potential of the dragon. It is computed before the owl code is 
    637649run and is superceded by the status as soon as that becomes 
    638650available. 
    639651@end quotation 
    640 @item status 
     652@item @code{status} 
    641653@cindex dragon status 
    642654@quotation 
    643655The dragon status is the best measure of the dragon's health. 
     
    649661Here are definitions of the fields in the @code{dragon2} array. 
    650662 
    651663@itemize @bullet 
    652 @item origin 
     664@item @code{origin} 
    653665@quotation 
    654666The origin field is duplicated here. 
    655667@end quotation 
    656 @item adjacent 
    657668@item @code{adjacent[MAX_NEIGHBOR_DRAGONS]} 
    658 @cindex neighbor dragons 
    659 @cindex adjacent dragons 
    660 @findex find_neighbor_dragons 
    661 @quotation 
    662 Dragons of either color near the given one are called @dfn{neighbors}. 
    663 They are computed by the function @code{find_neighbor_dragons()}. 
    664 The @code{dragon2.adjacent} array gives the dragon numbers of 
    665 these dragons. 
    666 @end quotation 
    667669@item @code{neighbors} 
    668670@cindex neighbor dragons 
    669671@cindex adjacent dragons 
     
    671673@quotation 
    672674Dragons of either color near the given one are called @dfn{neighbors}. 
    673675They are computed by the function @code{find_neighbor_dragons()}. 
    674 The @code{dragon2.adjacent} array gives the dragon numbers of 
    675 these dragons. 
     676The @code{adjacent} array gives the dragon numbers of 
     677these dragons and @code{neighbors} gives the number of them. 
    676678@end quotation 
    677 @item neighbors 
    678 @quotation 
    679 The number of neighbor dragons. 
    680 @end quotation 
    681 @item hostile_neighbors 
     679@item @code{hostile_neighbors} 
    682680@quotation 
    683681The number of neighbor dragons of the opposite color. 
    684682@end quotation 
    685 @item moyo_size 
    686 @item float moyo_territorial_value 
     683@item @code{moyo_size} 
     684@item @code{moyo_territorial_value} 
    687685@findex compute_surrounding_moyo_sizes 
    688686@quotation 
    689687The function @code{compute_surrounding_moyo_sizes()} assigns 
     
    691689each dragon (@pxref{Territory and Moyo}). This is the  
    692690moyo size. They are recorded in these fields. 
    693691@end quotation 
    694 @item safety 
     692@item @code{safety} 
    695693@cindex dragon safety 
    696694@quotation 
    697695The dragon safety can take on one of the values 
     
    707705@item INESSENTIAL - the dragon is unimportant (e.g. nakade stones) and dead 
    708706@end itemize 
    709707@end quotation 
    710 @item weakness 
    711 @item weakness_pre_owl 
     708@item @code{weakness} 
     709@item @code{weakness_pre_owl} 
    712710@cindex dragon weakness 
    713711@cindex weakness 
    714712@quotation 
     
    717715dragons in greater need of safety. The field @code{weakness_pre_owl} 
    718716is a preliminary computation before the owl code is run. 
    719717@end quotation 
    720 @item escape_route 
     718@item @code{strategic_size} 
     719@cindex strategic_size 
     720@quotation 
     721An effective size including weakness of neighbors. 
     722@end quotation 
     723@item @code{escape_route} 
    721724@cindex dragon escape_route 
    722725@cindex escape_route 
    723726@findex compute_escape 
     
    726729in case it cannot make two eyes locally. Documentation 
    727730may be found in @ref{Escape}. 
    728731@end quotation 
    729 @item struct eyevalue genus 
     732@item @code{genus} 
    730733@cindex dragon genus 
    731734@cindex genus 
    732735@quotation 
     
    744747 
    745748@end example 
    746749@end quotation 
    747 @item heye 
     750@item @code{heye} 
    748751@quotation 
    749752Location of a half eye attached to the dragon. 
    750753@end quotation 
    751 @item lunch 
     754@item @code{lunch} 
    752755@cindex dragon lunch 
    753756@cindex lunch 
    754757@quotation 
     
    756759can be captured. In contrast with worm lunches, a dragon 
    757760lunch must be able to defend itself. 
    758761@end quotation 
    759 @item surround_status 
    760 @item surround_size 
     762@item @code{surround_status} 
     763@item @code{surround_size} 
    761764@cindex surround_status 
    762765@cindex surround_size 
    763766@cindex surround 
     
    766769it is @dfn{surrounded}. See @ref{Surrounded Dragons} and 
    767770the comments in @file{surround.c} for more information about the 
    768771algorithm.  Used in computing the escape_route, and also callable 
    769 from patterns (currently used by CB258) 
     772from patterns 
    770773@end quotation 
    771 @item semeais 
    772 @item semeai_defense_point 
    773 @item semeai_defense_certain 
    774 @item semeai_attack_point 
    775 @item semeai_attack_certain 
    776 @cindex semeai 
     774@item @code{semeais} 
     775@item @code{semeai_defense_code} 
     776@item @code{semeai_defense_point} 
     777@item @code{semeai_defense_certain} 
     778@item @code{semeai_defense_target} 
     779@item @code{semeai_attack_code} 
     780@item @code{semeai_attack_point} 
     781@item @code{semeai_attack_certain} 
     782@item @code{semeai_attack_target} 
     783@cindex semeais 
     784@cindex semeai_defense_code 
    777785@cindex semeai_defense_point 
    778786@cindex semeai_defense_certain 
     787@cindex semeai_defense_target 
     788@cindex semeai_attack_code 
    779789@cindex semeai_attack_point 
    780790@cindex semeai_attack_certain 
     791@cindex semeai_attack_target 
    781792@quotation 
    782793If two dragons of opposite color both have the status CRITICAL 
    783794or DEAD they are in a @dfn{semeai} (capturing race), and their 
     
    785796@code{owl_analyze_semeai()} in @file{owl.c}, which attempts to 
    786797determine which is alive, which dead, or if the result is 
    787798seki, and whether it is important who moves first. The 
    788 function @file{new_semeai()} in @file{semeai.c} attempts 
     799function @code{semeai()} in @file{semeai.c} attempts 
    789800to revise the statuses and to generate move reasons based 
    790801on these results. The field @code{dragon2.semeais} is nonzero 
    791802if the dragon is an element of a semeai, and equals the 
    792803number of semeais (seldom more than one). The semeai defense 
    793804and attack points are locations the defender or attacker 
    794 must move to win the semeai. The field @code{semeai_margin_of_safety} 
    795 is intended to indicate whether the semeai is close or not 
    796 but currently this field is not maintained. The fields 
     805must move to win the semeai and the result code of these moves is 
     806also stored. In @code{semeai_defense_target} and 
     807@code{semeai_attack_target} an origin of an opponent dragon in 
     808semeai, on which the move has impact, is stored. The fields 
    797809@code{semeai_defense_certain} and @code{semeai_attack_certain} 
    798810indicate that the semeai code was able to finish analysis 
    799811without running out of nodes. 
    800812@end quotation 
    801 @item owl_status 
     813@item @code{owl_threat_status} 
     814@quotation 
     815Informs, whether the dragon has any defense or attack threats 
     816(@code{CAN_THREATEN_ATTACK} or @code{CAN_THREATEN_DEFENSE}). 
     817@end quotation 
     818@item @code{owl_status} 
    802819@quotation 
    803820This is a classification similar to @code{dragon.crude_status}, but 
    804821based on the life and death reading in @file{owl.c}. 
     
    810827@code{owl_defend()} is run, and if it can be defended it 
    811828is classified as @code{CRITICAL}, and if not, as @code{DEAD}. 
    812829@end quotation 
    813 @item owl_attack_point 
     830@item @code{owl_attack_point} 
    814831@cindex owl_attack_point 
    815832@quotation 
    816833If the dragon can be attacked this is the point to attack the dragon. 
    817834@end quotation 
    818 @item owl_attack_code 
     835@item @code{owl_attack_code} 
    819836@cindex owl_attack_code 
    820837@quotation 
    821 The owl attack code, It can be WIN, KO_A, KO_B or 0 (@pxref{Return Codes}). 
     838The owl attack code, It can be WIN, KO_A, GAIN, LOSS, 
     839KO_B or 0 (@pxref{Return Codes}). 
    822840@end quotation 
    823 @item owl_attack_certain 
     841@item @code{owl_attack_certain} 
    824842@cindex owl_attack_certain 
    825843@quotation 
    826844The owl reading is able to finish analyzing the attack 
    827845without running out of nodes. 
    828846@end quotation 
    829 @item owl_second_attack_point 
     847@item @code{owl_attack_node_count} 
     848@cindex owl_attack_node_count 
     849@quotation 
     850Number of nodes used during analyze of attack move. 
     851@end quotation 
     852@item @code{owl_second_attack_point} 
    830853@cindex owl_second_attack_point 
    831854@quotation 
    832855A second attack point. 
    833856@end quotation 
    834 @item owl_defense_point 
     857@item @code{owl_defense_point} 
    835858@cindex owl_defense_point 
    836859@quotation 
    837860If the dragon can be defended, this is the place to play. 
    838861@end quotation 
    839 @item owl_defense_code 
     862@item @code{owl_defense_code} 
    840863@cindex owl_defense_code 
    841864@quotation 
    842 The owl defense code, It can be WIN, KO_A, KO_B or 0 (@pxref{Return Codes}). 
     865The owl defense code, It can be WIN, KO_A, GAIN, LOSS, 
     866KO_B or 0 (@pxref{Return Codes}). 
    843867@end quotation 
    844 @item owl_defense_certain 
     868@item @code{owl_defense_certain} 
    845869@cindex owl_defense_certain 
    846870@quotation 
    847871The owl code is able to finish analyzing the defense without 
    848872running out of nodes. 
    849873@end quotation 
    850 @item owl_second_defense_point 
     874@item @code{owl_second_defense_point} 
    851875@cindex owl_second_defense_point 
    852876@quotation 
    853877A second owl defense point. 
    854878@end quotation 
     879@item @code{owl_attack_kworm} 
     880@cindex owl_attack_kworm 
     881@quotation 
     882Position of a worm, which can be killed during attack on the dragon 
     883(@code{owl_attack_code} has to be @code{GAIN}). 
     884@end quotation 
     885@item @code{owl_defense_kworm} 
     886@cindex owl_defense_kworm 
     887@quotation 
     888Position of our worm (part of the dragon) abandoned during defense of 
     889the dragon (@code{owl_defend_code} has to be @code{LOSS}). 
     890@end quotation 
    855891@end itemize 
    856892 
    857893@node Dragons in Color 
  • doc/install.texi

    RCS file: /home/arend/Go/gnugo-rsync/gnugo/doc/install.texi,v
    retrieving revision 1.25
    diff -u -p -r1.25 install.texi
     
    130130@node Default Level 
    131131@subsection Default Level 
    132132 
    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. 
     133GNU Go can play at different levels. Level may be as high as you wish 
     134but it will make GNU Go play slower (up to level 12 is recommended). At 
     135level 10 GNU Go is much more accurate but takes an average of about 1.6 
     136times longer to play than at level 8. 
    136137 
    137138The level can be set at run time using the @option{--level} option. 
    138139If you don't set this, the default level will be used. You 
     
    146147@noindent 
    147148sets the default level to 9. If you omit this parameter, 
    148149the compiler sets the default level to 10. We recommend 
    149 using level 10 unless you find it too slow. If you decide 
     150using level 12 unless you find it too slow. If you decide 
    150151you want to change the default you may rerun configure 
    151152and recompile the program. 
    152153 
     
    235236This is on by default. 
    236237@end itemize 
    237238 
     239There is one more option, which allows disabling of all unneeded 
     240things in code - like stats, asserts, etc. It should be used only 
     241to generate final release of the program and can be changed only 
     242as configure option. 
     243 
     244@itemize @bullet 
     245@item @code{final-release} Disable unneeded things. 
     246@end itemize 
     247 
    238248@node Windows and MS-DOS, Macintosh, Configure Options, Installation 
    239249@section Compiling GNU Go on Microsoft platforms 
    240250 
  • doc/move_generation.texi

    RCS file: /home/arend/Go/gnugo-rsync/gnugo/doc/move_generation.texi,v
    retrieving revision 1.18
    diff -u -p -r1.18 move_generation.texi
     
    214214the simultaneous attack of one worm and the defense of another. As for 
    215215attack and defense moves, it's important that all moves which win a 
    216216semeai are found, so an informed choice can be made between them. 
     217Semeai move reasons are set by the semeai module. 
     218 
     219One might also wish to list moves which increase the lead in a semeai 
     220race (removes ko threats) for use as secondary move reasons. Analogously, 
     221if we are behind in the race. However this has not been implemented yet. 
    217222 
    218 Semeai move reasons should be set by the semeai module. However this 
    219 has not been implemented yet. One might also wish to list moves 
    220 which increase the lead in a semeai race (removes ko threats) for use 
    221 as secondary move reasons. Analogously if we are behind in the race. 
    222223 
    223224@node  Making eyes 
    224225@subsection Making or destroying eyes 
     
    229230will be valued substantially higher if this is the case. As usual it's 
    230231important to find all moves that change the eye count. 
    231232 
    232 (This is part of what eye_finder was doing. Currently it only finds 
    233 one vital point for each unstable eye space.) 
     233The eye module (@file{optics.c}) is handling this. It uses eyes patterns 
     234database @file{patterns/eyes.db}. 
    234235 
    235236@node  Antisuji moves 
    236237@subsection Antisuji moves 
     
    247248territory move reason. That move reason is added by the @samp{e} 
    248249patterns in @file{patterns/patterns.db}. Similarly the @samp{E} patterns 
    249250attempt to generate or mitigate a moyo, which is a region of influence 
    250 not yet secure territory, yet valuable. Such a pattern sets the ``expand 
    251 moyo'' move reason. 
     251not yet secure territory, yet valuable. There are also other patterns for 
     252reducing territory, invasions and making bariers (to defend before 
     253invasions) - they are in @file{patterns/influence.db} and 
     254@file{patterns/barriers.db}. These patterns set the ``expand moyo'', 
     255``expand territory'' and ``invasion'' move reasons. They also have 
     256influence on a move territorial valuation. 
    252257 
    253258@node Owl attack and defense 
    254259@subsection Attacking and Defending Dragons 
     
    310315as explained for example in @emph{The Endgame} by Ogawa 
    311316and Davies. 
    312317 
    313 Moves are valued with respect to four different criteria. These are 
     318Moves are valued with respect to four different main criteria. These 
     319are 
    314320 
    315321@itemize @bullet 
    316322@item territorial value 
     
    362368* Minimum Value::                 Minimum value 
    363369* Secondary Value::               Other, more indirect, gains from a move 
    364370* Threats and Followup Value::    Valuation of attack and defense threats 
     371* Additional ko value::    Additional threat value for a ko fight 
    365372@end menu 
    366373 
    367374@node Territorial value 
     
    384391 
    385392@node Strategical value 
    386393@subsection Strategical Value 
     394@findex estimate_strategical_value 
    387395 
    388396Strategical defense or attack reasons are assigned to any move 
    389397which matches a pattern of type @samp{a} or @samp{d}. These are 
     
    394402to check its status or safety. This is done later, during 
    395403the valuation phase. 
    396404 
     405The whole algorithm is placed in @code{estimate_strategical_value}. 
     406 
    397407@node Shape factor 
    398408@subsection Shape Factor 
    399409 
     
    451461which we cannot legally take, then such a move becomes attractive as a ko 
    452462threat and the full followup value is taken into account. 
    453463 
     464@node Additional ko value 
     465@subsection Additional ko value 
     466 
     467Some moves give us additional threats and some give them to an opponent. 
     468In such situations we should give some bonus or penalty for creating ko 
     469threats. As for now only positive contribution is counted. 
     470 
    454471@node End Game 
    455472@section End Game 
    456473 
  • doc/patterns.texi

    RCS file: /home/arend/Go/gnugo-rsync/gnugo/doc/patterns.texi,v
    retrieving revision 1.19
    diff -u -p -r1.19 patterns.texi
     
    8585Elements are not generated for @samp{?} markers, but they are not 
    8686completely ignored - see below. 
    8787         
    88 The line beginning @samp{:} describes various attributes of the pattern, such 
    89 as its symmetry and its class. Optionally, a function called a 
    90 ``helper'' can be provided to assist the matcher in deciding whether 
    91 to accept move. Most patterns do not require a helper, and this field 
    92 is filled with NULL. 
    93  
    9488@findex shapes_callback 
    9589The matcher in @file{matchpat.c} searches the board for places where this 
    9690layout appears on the board, and the callback function 
     
    10094After the pattern, there is some supplementary information in the format: 
    10195@example 
    10296 
    103   :trfno, classification, [values], helper_function 
     97  :trfno, attributes, [values], helper_function 
    10498 
    10599@end example 
    106100 
     
    110104represents the axis of symmetry. (E.g. @samp{|} means symmetrical about a 
    111105vertical axis.) 
    112106 
     107@code{helper_function} is a function that can be provided to assist the matcher 
     108in deciding whether to accept move. Most patterns do not require a helper, 
     109and this field is filled with NULL. 
     110 
    113111The above pattern could equally well be written on the left edge: 
    114112 
    115113@example 
     
    127125way, or for that matter, on the top or right edges, or in any 
    128126of the four corners. As a matter of convention all the edge patterns  
    129127in @file{patterns.db} are written on the bottom edge or in the lower left 
    130 corners. In the @file{patterns/} directory there is a program called 
    131 @code{transpat} which can rotate or otherwise transpose patterns. 
    132 This program is not built by default---if you think you need it, 
    133 @code{make transpat} in the @file{patterns/} directory and 
    134 consult the usage remarks at the beginning of @file{patterns/transpat.c}. 
     128corners. 
    135129 
    136130@node  Pattern Classification 
    137131@section Pattern Attributes 
     
    415409need to remove the stones we placed from the reading stack. This is done 
    416410with the function @code{popgo()}. 
    417411 
     412IMPORTANT: The macro @code{OFFSET} is not used anymore, because it has 
     413fixed coordinates and patterns can be now rotated randomly by DFA 
     414optimizer. All helpers that require usage of this macro have to be moved 
     415to autohelpers. 
     416 
    418417@node  Autohelpers and Constraints 
    419418@section Autohelpers and Constraints 
    420419 
     
    566565The autohelper functions are translated into C code by the program in 
    567566@file{mkpat.c}. To see exactly how the functions are implemented, 
    568567consult the autohelper function definitions in that file. Autohelper 
    569 functions can be used in both constraint and action lines. 
     568functions can be used in both constraint and action lines. Here is 
     569a partial list of them: 
    570570 
    571571@example 
    572572 
     
    10631063 
    10641064The patterns in @file{conn.db} are used for helping @code{make_dragons()} 
    10651065amalgamate worms into dragons and to some extent for modifying eye spaces. 
    1066 The patterns in this database use the classifications @samp{B},  
    1067 @samp{C}, and @samp{e}. @samp{B} patterns are used for finding cutting points, 
     1066The patterns in this database use the classifications @samp{B} and  
     1067@samp{C}. @samp{B} patterns are used for finding cutting points, 
    10681068where amalgamation should not be performed, @samp{C} patterns are used for 
    1069 finding existing connections, over which amalgamation is to be done, and  
    1070 @samp{e} patterns are used for modifying eye spaces and reevaluating lunches. 
     1069finding existing connections, over which amalgamation is to be done. 
    10711070There are also some patterns without classification, which use action lines to 
    10721071have an impact. These are matched together with the @samp{C} patterns. Further 
    10731072details and examples can be found in @xref{Worms and Dragons}. 
     
    11811180@findex find_connections 
    11821181@quotation  
    11831182Find explicit connection patterns and amalgamate the involved dragons. 
    1184 This goes through the connection database consulting patterns except those of 
    1185 type B, E or e. When such a function is found, the function 
     1183This goes through the connection database consulting only patterns of type C. 
     1184When such a function is found, the function 
    11861185@code{cut_connect_callback} is invoked. 
    11871186@end quotation 
    1188 @item void modify_eye_spaces1(void) 
    1189 @findex modify_eye_spaces1 
    1190 @quotation  
    1191 Find explicit connection patterns and amalgamate the involved dragons. 
    1192 This goes through the connection database consulting only patterns 
    1193 of type E (@pxref{Connections Database}). When such a function is found, the 
    1194 function @code{cut_connect_callback} is invoked.   
    1195 @end quotation 
    1196 @item void modify_eye_spaces1(void) 
    1197 @findex modify_eye_spaces1 
    1198 @quotation  
    1199 Find explicit connection patterns and amalgamate the involved dragons. 
    1200 This goes through the connection database consulting only patterns 
    1201 of type e (@pxref{Connections Database}). When such a function is found, the 
    1202 function @code{cut_connect_callback} is invoked.   
    1203 @end quotation 
    12041187@end itemize 
    12051188 
    12061189@node  Tuning 
     
    13971380@file{patterns.h}) by a standalone program @file{mkpat.c}, and the resulting  
    13981381@file{.c} files are compiled and linked into the main GNU Go executable. 
    13991382 
     1383IMPORTANT: After any change in patterns, which uses DFA pattern matching, one 
     1384should optimize pattern databases, in which the changes was made. This is done 
     1385by running a part of @file{optimize} script in @file{patterns} directory. Run 
     1386only parts of this script, which refers to desired databases, because it takes 
     1387a very long time to execute. 
     1388 
    14001389Each pattern is compiled to a header, and a sequence of elements, 
    14011390which are (notionally) checked sequentially at every position and 
    14021391orientation of the board. These elements are relative to the pattern 
  • doc/reading.texi

    RCS file: /home/arend/Go/gnugo-rsync/gnugo/doc/reading.texi,v
    retrieving revision 1.20
    diff -u -p -r1.20 reading.texi
     
    6666 
    6767The function @code{do_attack} and @code{do_find_defense} are wrappers 
    6868themselves and call @code{attack1}, @code{attack2}, @code{attack3} or 
    69 @code{attack4} resp.  @code{defend1}, @code{defend1}, @code{defend1} 
    70 or @code{defend1} depending on the number of liberties. 
     69@code{attack4} resp.  @code{defend1}, @code{defend2}, @code{defend3} 
     70or @code{defend4} depending on the number of liberties. 
    7171 
    7272These are fine-tuned to generate and try out the moves in an efficient 
    7373order. They generate a few moves themselves (mostly direct liberties 
     
    1231233 liberties are considered, but branching is inhibited, so fewer 
    124124variations are considered. 
    125125 
    126 %@findex small_semeai 
    127 %Currently the reading code does not try to defend a string by 
    128 %attacking a boundary string with more than two liberties. Because 
    129 %of this restriction, it can make oversights. A symptom of this is 
    130 %two adjacent strings, each having three or four liberties, each 
    131 %classified as @code{DEAD}. To resolve such situations, a function 
    132 %@code{small_semeai()} (in @file{engine/semeai.c}) looks for such 
    133 %pairs of strings and corrects their classification. 
    134  
    135126The @code{backfill_depth} is a similar variable with a default 12. Below 
    136127this depth, GNU Go will try "backfilling" to capture stones. 
    137128For example in this situation: 
     
    173164be attacked, and if so, @code{*move} returns the attacking move, 
    174165unless @code{*movei} is a null pointer. (Use null pointers if 
    175166you are interested in the result of the attack but not the 
    176 attacking move itself.) Returns @code{WIN}, if the attack succeeds, 
    177 0 if it fails, and @code{KO_A} or @code{KO_B} if the result depends on ko 
    178 @ref{Return Codes}. 
     167attacking move itself.) Returns a result code of the move 
     168@xref{Return Codes}. 
    179169@end quotation 
    180170@findex find_defense 
    181171@item @code{find_defense(int str, int *move)} 
    182172@quotation  
    183 Attempts to find a move that will save the string at @code{str}. It 
    184 returns true if such a move is found, with @code{*move} the location 
     173Attempts to find a move that will save the string at @code{str}, and if 
     174so, @code{*move} returns the location 
    185175of the saving move (unless @code{*move} is a null pointer). It is not 
    186176checked that tenuki defends, so this may give an erroneous answer if 
    187 @code{!attack(str)}.  Returns @code{KO_A} or @code{KO_B} if the 
    188 result depends on ko @xref{Return Codes}.  
     177@code{!attack(str)}.  Returns a result code of the move 
     178@xref{Return Codes}.  
    189179@end quotation 
    190180@findex safe_move 
    191181@item @code{safe_move(int str, int color)} : 
    192182@quotation 
    193183The function @code{safe_move(str, color)} checks whether a move at 
    194184@code{str} is illegal or can immediately be captured. If @code{stackp==0} 
    195 the result is cached. If the move only can be captured by a ko, it's 
    196 considered safe. This may or may not be a good convention. 
     185the result is cached. Returns a result code of an attack on the placed 
     186stone. 
    197187@end quotation 
    198188@end itemize 
    199189 
     
    225215option @pxref{Invoking GNU Go}. 
    226216 
    227217The hash table is created once and for all at the beginning of 
    228 the game by the function @code{hashtable_new()}. Although hash 
     218the game by the function @code{reading_cache_init()}. Although hash 
    229219memory is thus allocated only once in the game, the table is 
    230220reinitialized at the beginning of each move by a call to 
    231 @code{hashtable_clear()} from @code{genmove()}. 
     221@code{reading_cache_clear()} from @code{genmove()}. 
    232222 
    233223@menu 
    234224* Hash Calculation::            Calculation of the hash value 
    235225* Hash Organization::           Organization of the hash table 
    236 * Hash Structures::             Structures in @file{hash.h} 
    237226@end menu 
    238227 
    239228@node Hash Calculation 
     
    249238@enumerate 
    250239@item First we define a @dfn{go position}.  This positions consists of 
    251240@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 as 
     241@item the actual board, i.e. the locations and colors of the stones; 
     242@item a @dfn{ko point}, if a ko is going on; the ko point is defined as 
    254243the empty point where the last single stone was situated before 
    255244it was captured. 
    256245@end itemize 
    257246 
     247In addition to that we include some more information into the hash code, 
     248that describes stored analisys results: 
     249@itemize @bullet 
     250@item a @dfn{komaster} and @dfn{kom_pos}, @xref{Ko}, 
     251@item an ID (an int between 0 and 255) of a function used to calculate 
     252the results; 
     253@item a target of analisys (up to two positions on a board); 
     254@item sometimes some extra information used by various functions. 
     255@end itemize 
     256 
    258257It is not necessary to specify the color to move (white or black) 
    259258as part of the position. The reason for this is that read results 
    260259are stored separately for the various reading functions such as 
    261260@code{attack3}, and it is implicit in the calling function which 
    262261player is to move. 
    263262 
    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  
     263@item For each of the above information (excluding extra information) 
     264we generate tables with random numbers for each: function, komaster 
     265status or position on a board. 
    271266These random numbers are generated once at initialization time and 
    272267then used throughout the life time of the hash table. 
    273268 
    274269@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). 
     270which are applicable for the position. If extra information is needed 
     271it is passed by a function as a hash code which is XORed into the 
     272resulting hash key. 
    277273@end enumerate 
    278274 
    279275@node Hash Organization 
    280276@subsection Organization of the hash table 
    281277 
    282 The hash table consists of 3 parts: 
    283  
    284 @cindex Hash node 
    285 @cindex Read result 
    286  
    287 @itemize @bullet 
    288 @item An area which contains so called @dfn{Hash Nodes}. Each hash node 
    289 contains: 
    290 @itemize @minus 
    291 @item A go position as defined above. 
    292 @item A computed hash value for the position 
    293 @item A pointer to Read Results (see below) 
    294 @item A pointer to another hash node. 
    295 @end itemize 
    296  
    297 @item An area with so called Read Results.  These are used to store 
    298 which function was called in the go position, which string was 
    299 under attack or to be defended, and the result of the reading. 
    300  
    301 Each Read Result contains:  
    302 @itemize @minus 
    303 @item the function ID (an int between 0 and 255), the position of the 
    304 string under attack and a depth value, which is used to 
    305 determine how deep the search was when it was made, packed into 
    306 one 32 bit integer.  
    307 @item The result of the search (a numeric value) and a position to 
    308 play to get the result packed into one 32 bit integer.  
    309 @item A pointer to another Read Result. 
    310 @end itemize 
    311  
    312 @item An array of pointers to hash nodes.  This is the hash table 
    313 proper. 
    314  
    315 @end itemize 
    316  
    317 When the hash table is created, these 3 areas are allocated using 
    318 @code{malloc()}.  When the hash table is populated, all contents are taken 
    319 from the Hash nodes and the Read results. No further allocation is 
    320 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 totally 
    322 emptied, at which point it can be used again as if newly initialized. 
    323  
    324 @findex hashtable_search 
    325 When a function wants to use the hash table, it looks up the current 
    326 position using @code{hashtable_search()}. If the position doesn't already 
    327 exist there, it can be entered using 
    328  
    329 @findex hashtable_enter_position 
    330 @code{hashtable_enter_position()}.   
    331  
    332 @findex hashtable_enter_position 
    333 Once the function has a pointer to the hash node containing a 
    334 function, it can search for a result of a previous search using 
    335 @code{hashnode_search()}.  If a result is found, it can be used, and 
    336 if not, a new result can be entered after a search using  
    337 @findex hashnode_new_result 
    338 @code{hashnode_new_result()}. 
    339  
    340 Hash nodes which hash to the same position in the hash table 
    341 (collisions) form a simple linked list.  Read results for the same 
    342 position, created by different functions and different attacked or 
    343 defended strings also form a linked list. 
    344  
    345 This is deemed sufficiently efficient for now, but the representation 
    346 of collisions could be changed in the future.  It is also not 
    347 determined what the optimum sizes for the hash table, the number of 
    348 positions and the number of results are. 
    349  
    350 @node Hash Structures 
    351 @subsection Hash Structures 
    352  
    353278The basic hash structures are declared in @file{engine/hash.h} and 
    354 @file{engine/cache.c} 
     279@file{engine/cache.h} 
    355280 
    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. 
     281The hash table consists of an array of pointers to hash entries and 
     282variable that defines number of the entries. 
    366283 
    367284@example 
    368285typedef struct @{ 
    369   Hashvalue     hashval; 
    370   Hashposition  hashpos; 
    371 @} Hash_data; 
    372 @end example 
     286  unsigned int num_entries; 
     287  Hashentry *entries; 
     288@} Transposition_table; 
    373289 
    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; 
     290Transposition_table ttable; 
    384291@end example 
    385292 
    386 The data1 field packs into 32 bits the following fields: 
    387  
    388 @example 
     293@cindex Hash entry 
    389294 
    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: 
     295The @dfn{Hash Entry} consists of two @dfn{Hash Nodes}. One is the 
     296most reliable node and the second is the newest. The reliability is 
     297computed based on cost of the function, which created a node and 
     298depth of analysis for that node (the lower depth the more reliable 
     299results). 
    399300 
    400301@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  
     302typedef struct @{ 
     303  Hashnode most_reliable; 
     304  Hashnode newest; 
     305@} Hashentry; 
    408306@end example 
    409307 
    410 The @code{komaster} and @code{(kom_pos)} field are 
    411 documented in @xref{Ko}. 
     308@cindex Hash node 
    412309 
    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. 
     310Each hash node contains a computed hash value (as defined above) 
     311and @dfn{Read Results}. 
    419312 
    420313@example 
    421 typedef struct hashnode_t @{ 
    422   Hash_data            key; 
    423   Read_result        * results; 
    424   struct hashnode_t  * next; 
     314typedef struct @{ 
     315  Hash_data key; 
     316  HASHNODE_DATATYPE data; /* 32-bit value */ 
    425317@} Hashnode; 
    426318@end example 
    427319 
    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. 
     320@cindex Read result 
    431321 
    432 There is also a pointer to another hash node which is used when 
    433 the nodes are sorted into hash buckets (see below). 
     322Read Results are used to store which function was called in the go 
     323position, which string was under attack or to be defended, and the 
     324result of the reading. The result is packed into one 32 bit integer. 
     325Each Read Result contains:  
     326@itemize @minus 
     327@item a remaining (to the max depth) depth value, which is used to 
     328determine how deep the search was when node was stored (5 bits);  
     329@item the results of the search (two numeric values - 2 x 4 bits); 
     330@item a cost of a function which stored the result (an arbitrary 
     331numeric value) (4 bits); 
     332@item a move to play to get the result (10 bits). 
     333@end itemize 
    434334 
    435335@example 
    436 typedef struct hashtable @{ 
    437   size_t         hashtablesize; /* Number of hash buckets */ 
    438   Hashnode    ** hashtable;     /* Pointer to array of hashnode lists */ 
     336#define hn_create_data(remaining_depth, value1, value2, move, cost) \ 
     337    ((((value1)         & 0x0f)  << 23) \ 
     338   | (((value2)         & 0x0f)  << 19) \ 
     339   | (((move)           & 0x3ff) <<  9) \ 
     340   | (((cost)           & 0x0f)  <<  5) \ 
     341   | (((remaining_depth & 0x1f)/*<<  0*/))) 
     342@end example 
    439343 
    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. */ 
     344When the hash table is created, the hash entries are allocated using 
     345@code{malloc()}. After that, no further allocation is 
     346done and when all nodes or results are used, the hash table is full. 
     347Nothing is deleted, instead nodes are replaced by newer or more 
     348reliable nodes (when collision occurs). 
    443349 
    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 
     350@findex tt_get 
     351When a function wants to use the hash table, it looks up the current 
     352position using @code{tt_get()}. If the position doesn't already 
     353exist there, it can be entered using 
    449354 
    450 The hash table consists of three parts: 
     355@findex tt_update 
     356@code{tt_update()}.   
    451357 
    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 
     358@findex tt_update 
     359There are several macros which store the result and return it from 
     360a searching functions. They are named @code{READ_RETURN0}, 
     361@code{READ_RETURN}, @code{READ_RETURN_SEMEAI}, @code{READ_RETURN_CONN}, 
     362@code{READ_RETURN_HASH} and @code{READ_RETURN2} and can be found in 
     363@file{engine/cache.h}. 
    461364 
    462365@node Persistent Cache 
    463366@section Persistent Reading Cache 
     
    475378Some calculations can be safely saved from move to move. If the 
    476379opponent's move is not close to our worm or dragon, we do not have to 
    477380reconsider the life or death of that group on the next move. So 
    478 the result is saved in a persistent cache. Persistent caches are used for 
     381the result is saved in a persistent cache. Persistent caches 
    479382are used in the engine for several types of read results. 
    480383 
    481384@itemize @bullet 
     
    610513 
    611514The rationale behind this rule is that in the case where there are 
    612515two 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 the 
    614 case of a nested ko, taking one ko is a precondition to taking the 
    615 other one, so we allow this. 
     516komaster he has already chosen which ko he wants to win (the same reasoning 
     517applies to WEAK_KO rule). But in the case of a nested ko, taking one ko is 
     518a precondition to taking the other one, so we allow this. 
    616519 
    617520If the komaster's opponent takes a ko, then both players have taken one ko. In 
    618521this case @code{komaster} is set to @code{GRAY_BLACK} or @code{GRAY_WHITE} and 
     
    628531@itemize @bullet 
    629532@item 1. Komaster is EMPTY. 
    630533@itemize @minus 
    631 @item 1a. Unconditional ko capture is allowed. 
     534@item 1a) Unconditional ko capture is allowed. 
    632535@quotation 
    633536Komaster remains EMPTY if previous move was not a ko capture. 
    634537Komaster is set to WEAK_KO if previous move was a ko capture 
     
    642545@end itemize 
    643546@item 2. Komaster is O: 
    644547@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. 
     548@item 2a) Only nested ko captures are allowed. 
     549@quotation 
     550Kom_pos is moved to the new removed stone. 
     551@end quotation 
     552@item 2b) If the ko has been resolved in favor of the komaster (when the ko 
     553is filled or kom_pos is no longer a ko because of some capture) then the 
     554komaster reverts to EMPTY. 
    649555@end itemize 
    650556@item 3. Komaster is X: 
     557@itemize @minus 
     558@item 
     559Play at kom_pos is not allowed if it is the ko recapture. Any other ko capture 
     560is allowed. 
    651561@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. 
     562If O takes another ko, komaster becomes GRAY_X. 
    654563@end quotation 
     564@end itemize 
    655565@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 
     566@itemize @minus 
     567@item 
     568Ko captures are not allowed. If the ko has been resolved in favor of 
     569the komaster (when the ko is filled or kom_pos is no longer a ko because 
     570of some capture) then the komaster reverts to EMPTY. 
     571@end itemize 
    660572@item 5. Komaster is WEAK_KO: 
    661573@itemize @minus 
    662574@item 5a) After a non-ko move komaster reverts to EMPTY. 
    663575@item 5b) Unconditional ko capture is only allowed if it is nested ko capture. 
    664576@quotation 
    665 Komaster is changed to WEAK_X and kom_pos to the old value of 
    666 board_ko_pos. 
     577Kom_pos is moved to the old value of board_ko_pos. 
    667578@end quotation 
    668579@item 5c) Conditional ko capture is allowed according to the rules of 1b. 
    669580@end itemize 
     
    801712The correct resolution is that H1 attacks L1 unconditionally while K2 
    802713defends it with ko (code @code{KO_A}). 
    803714 
    804 After Black (X) takes the ko at K3, white can do nothing 
     715After Black (X) takes the ko at K2, white can do nothing 
    805716but retake the ko conditionally, becoming komaster. B cannot 
    806717do much, but in one variation he plays at K4 and W takes 
    807718at H1. The following position results: 
     
    821732@end example 
    822733 
    823734Now 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 be 
     735still komaster, he couldn't capture the ko at N3 and there would be 
    825736no way to finish off B. 
    826737 
    827738 
  • doc/using.texi

    RCS file: /home/arend/Go/gnugo-rsync/gnugo/doc/using.texi,v
    retrieving revision 1.31
    diff -u -p -r1.31 using.texi
     
    496496Use Japanese Rules. This is the default unless you specify 
    497497@option{--enable-chinese-rules} as a configure option. 
    498498@end quotation 
     499@item @option{--autolevel} 
     500@quotation 
     501Turns on level adjusting according to the left time. It doesn't apply to 
     502GTP mode (which is turned on by GTP commands). 
     503@end quotation 
     504@item @option{--min-level @var{amount}} 
     505@quotation 
     506If the time is running out, sets the minimum level with which GNU Go 
     507will play. If lower level is set with --level option, it sets 
     508--min-level to that lower value too. Used only when --autolevel is 
     509turned on. 
     510@end quotation 
     511@item @option{--max-level @var{amount}} 
     512@quotation 
     513If much time is left, sets the maximum level with which GNU Go will 
     514play. If higher level is set with --level option, it sets --max-level 
     515to that higher value too. Used only when --autolevel is turned on. 
     516@end quotation 
    499517@item @option{--forbid-suicide}  
    500518@quotation 
    501519Do not allow suicide moves (playing a stone so that it ends up without 
     
    582600accuracy. For completeness, here they are. 
    583601 
    584602@itemize @bullet 
     603@item @option{--print-levels} 
     604@quotation 
     605Prints info about each level of play of GNU Go. 
     606@end quotation 
     607@end itemize 
     608 
     609@itemize @bullet 
    585610@item @option{-D}, @option{--depth @var{depth}} 
    586611@cindex depth 
    587612@quotation 
     
    621646depth (default 13), GNU Go still tries to attack strings with only 
    6226473 liberties, but only tries one move at each node. 
    623648@end quotation 
    624 @item @option{--break_chain-cutoff @var{depth}} 
     649@item @option{--break_chain-depth @var{depth}} 
    625650@quotation 
    626651Set the @code{break_chain_depth}. Beyond this depth, GNU Go abandons 
    627652some attempts to defend groups by trying to capture part of the surrounding 
     
    643668Such tactics are tried below @code{superstring_depth} and this 
    644669command line option allows this parameter to be set. 
    645670@end quotation 
     671@item @option{--semeai-node-limit @var{n}} 
     672@quotation 
     673If the number of variations exceeds this limit, Owl stops analyzing 
     674semeai moves. Default 500. 
     675@end quotation 
    646676@end itemize 
    647677 
    648678The preceeding options are documented with the reading code 
     
    724754GNU Go. It causes both the traces and the output file (@option{-o}) to 
    725755be more informative. 
    726756@end quotation 
     757@item @option{--limit-search @var{location}} 
     758@quotation 
     759Limits the area of allowed moves to a diamond with radius 6 with center 
     760at @var{location}. 
     761@end quotation 
    727762@item @option{-T}, @option{--printboard}: colored display of dragons. 
    728763@quotation 
    729764Use rxvt, xterm or Linux Console. (@pxref{Colored Display}) 
     
    732767@quotation 
    733768Print timing information to stderr. 
    734769@end quotation 
     770@item @option{--showscore} 
     771@quotation 
     772Print scoring information to stderr. 
     773@end quotation 
    735774@item @option{-E}, @option{--printeyes}: colored display of eye spaces 
    736775@quotation 
    737776Use rxvt, xterm or Linux Console. (@pxref{Colored Display}) 
     
    799838@quotation 
    800839Print statistics (for debugging purposes). 
    801840@end quotation 
     841@item @option{--profile-patterns} 
     842@quotation 
     843Print statistics for pattern usage. 
     844@end quotation 
    802845@item @option{-t}, @option{--trace} 
    803846@quotation 
    804847Print debugging information. Use twice for more detail. 
     
    919962The option @option{--capture-all-dead} requires the aftermath 
    920963code to finish capturing all dead stones. 
    921964@end quotation 
     965@item @option{--play-out-aftermath} 
     966@quotation 
     967Forces playing of aftermath (see --score). 
     968@end quotation 
    922969@end itemize 
    923970 
    924971@subsection Experimental options 
  • doc/utils.texi

    RCS file: /home/arend/Go/gnugo-rsync/gnugo/doc/utils.texi,v
    retrieving revision 1.19
    diff -u -p -r1.19 utils.texi
     
    3535@item @code{int does_attack(int move, int str)} 
    3636@findex does_attack 
    3737@quotation 
    38 returns true if the move at @code{move} attacks @code{str}. This means that it captures 
    39 the string, and that @code{str} is not already dead.   
     38returns the result code for an attack on the string @code{'str'} by the move 
     39@code{'move'}. However, if the move does not improve the attack result compared 
     40to tenuki, 0 is returned. In particular if the string is already captured, 
     41@code{does_attack()} always returns 0. 
    4042@end quotation 
    4143@item @code{int does_defend(int move, int str)} 
    4244@findex does_defend 
    4345@quotation 
    44 @code{does_defend(move, str)} returns true if the move at @code{move} 
    45 defends @code{str}. This means that it defends the string, and that 
    46 @code{str} can be captured if no defense is made. 
     46returns the result code for a defense on the string @code{'str'} by the move 
     47@code{'move'}. However, if the move does not improve the defense result compared 
     48to tenuki, 0 is returned. If the string (str) can't be captured if no defense 
     49is made, 0 is returned too. 
    4750@end quotation 
    4851@item @code{int somewhere(int color, int last_move, ...)} 
    4952@findex somewhere 
     
    514517@item @code{void dump_stack(void)} 
    515518@findex dump_stack 
    516519@quotation 
    517 for use under GDB prints the move stack. 
     520For use under GDB prints the move stack. 
     521@end quotation 
     522@item @code{void dump_incremental_board(void)} 
     523@findex dump_incremental_board 
     524@quotation 
     525Debug function. Dump all incremental board information. 
    518526@end quotation 
    519527@item @code{void add_stone(int pos, int color)} 
    520528@findex add_stone 
     
    588596different functions in this family. 
    589597 
    590598@itemize @bullet 
    591 @item @code{int countlib(int str)} 
     599@item @code{int countlib(int str_pos)} 
    592600@findex countlib 
    593601@quotation 
    594 Count the number of liberties of the string at @code{pos}. There 
    595 must be a stone at this location. 
     602Count the number of liberties of the string at @code{str_pos}. @code{str_pos} 
     603must not be empty. 
    596604@end quotation 
    597 @item @code{int findlib(int str, int maxlib, int *libs)} 
     605@item @code{int findlib(int str_pos, int maxlib, int *libs)} 
    598606@findex findlib 
    599607@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. 
     608Find the liberties of the string at @code{str_pos}. @code{str_pos} must not be 
     609empty. The locations of up to maxlib liberties are written into @code{libs[]}. 
     610The full number of liberties is returned.  If you want the locations of all 
     611liberties, whatever their number, you should pass @code{MAXLIBS} as the value 
     612for @code{maxlib} and allocate space for @code{libs[]} accordingly. 
    606613@end quotation 
    607614@item @code{int fastlib(int pos, int color, int ignore_captures)} 
    608615@findex fastlib 
     
    652659Next we have some general utility functions. 
    653660 
    654661@itemize @bullet 
    655 @item @code{int count_common_libs(int str1, int str2)} 
     662@item @code{int count_common_libs(int str1_pos, int str2_pos)} 
    656663@findex count_common_libs 
    657664@quotation 
    658665Find the number of common liberties of the two strings. 
    659666@end quotation 
    660 @item @code{int find_common_libs(int str1, int str2, int maxlib, int *libs)} 
     667@item @code{int find_common_libs(int str1_pos, int str2_pos, int maxlib, int *libs)} 
    661668@findex find_common_libs 
    662669@quotation 
    663670Find the common liberties of the two strings. The locations of up to 
     
    666673common liberties, whatever their number, you should pass @code{MAXLIBS} as the 
    667674value for @code{maxlib} and allocate space for @code{libs[]} accordingly. 
    668675@end quotation 
    669 @item @code{int have_common_lib(int str1, int str2, int *lib)} 
     676@item @code{int have_common_lib(int str1_pos, int str2_pos, int *lib)} 
    670677@findex have_common_lib 
    671678@quotation 
    672679Determine whether two strings have at least one common liberty. 
    673680If they do and @code{lib != NULL}, one common liberty is returned in  
    674681@code{*lib}. 
    675682@end quotation 
    676 @item @code{int countstones(int str)} 
     683@item @code{int countstones(int str_pos)} 
    677684@findex countstones 
    678685@quotation 
    679686Report the number of stones in a string. 
    680687@end quotation 
    681 @item @code{int findstones(int str, int maxstones, int *stones)} 
     688@item @code{int count_adjacent_stones(int str1_pos, int str2_pos, int maxstones)} 
     689@findex count_adjacent_stones 
     690@quotation 
     691Counts how many stones in one string are directly adjacent to the second 
     692string. A limit can be given in the @code{maxstones} parameter so that the 
     693function returns immediately. 
     694@end quotation 
     695@item @code{int findstones(int str_pos, int maxstones, int *stones)} 
    682696@findex findstones 
    683697@quotation 
    684 Find the stones of the string at @code{str}. The location must not be 
    685 empty. The locations of up to maxstones stones are written into 
    686 @code{stones[]}. The full number of stones is returned. 
     698Find the stones of the string at @code{str_pos}. The locations of up 
     699to maxstones stones are written into @code{stones[]}. The full number of 
     700stones is returned. 
    687701@end quotation 
    688 @item @code{int  chainlinks(int str, int adj[MAXCHAIN])} 
     702@item @code{int chainlinks(int str_pos, int adj[MAXCHAIN])} 
    689703@findex chainlinks 
    690704@quotation 
    691705This very useful function returns (in the @code{adj} array) the chains 
    692 surrounding the string at @code{str}. The number of chains is returned. 
     706surrounding the string at @code{str_pos}. The number of chains is returned. 
    693707@end quotation 
    694 @item @code{int chainlinks2(int str, int adj[MAXCHAIN], int lib)} 
     708@item @code{int chainlinks2(int str_pos, int adj[MAXCHAIN], int lib)} 
    695709@findex chainlinks2 
    696710@quotation 
    697711Returns (in @code{adj} array) those chains surrounding the string at 
    698 @code{str}, which has exactly @code{lib} liberties. The number of such chains 
     712@code{str_pos}, which has exactly @code{lib} liberties. The number of such chains 
    699713is returned. 
    700714@end quotation 
    701 @item @code{int chainlinks3(int str, int adj[MAXCHAIN], int lib)} 
     715@item @code{int chainlinks3(int str_pos, int adj[MAXCHAIN], int lib)} 
    702716@findex chainlinks3 
    703717@quotation 
    704718Returns (in @code{adj} array) the chains surrounding 
    705 the string at @code{str}, which have less or equal @code{lib} liberties. 
     719the string at @code{str_pos}, which have less or equal @code{lib} liberties. 
    706720The number of such chains is returned. 
    707721@end quotation 
    708 @item @code{int extended_chainlinks(int str, int adj[MAXCHAIN], int both_colors)} 
     722@item @code{int extended_chainlinks(int str_pos, int adj[MAXCHAIN], int both_colors)} 
    709723@findex extended_chainlinks 
    710724@quotation 
    711725Returns (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 such 
    713 strings is returned.  If the both_colors parameter is true, also own strings 
     726to string at @code{str_pos} or having a common liberty with @code{str_nr}. The number 
     727of such strings is returned.  If the both_colors parameter is true, also own strings 
    714728sharing a liberty are returned. 
    715729@end quotation 
    716 @item @code{int find_origin(int str)} 
     730@item @code{int find_origin(int str_pos)} 
    717731@findex find_origin 
    718732@quotation 
    719733Find the origin of a string, i.e. the point with the smallest 1D board 
     
    727741i.e. whether it would get more than one liberty. This function 
    728742returns true also for the case of a suicide move. 
    729743@end quotation 
    730 @item @code{int liberty_of_string(int pos, int str)} 
     744@item @code{int liberty_of_string(int pos, int str_pos)} 
    731745@findex liberty_of_string 
    732746@quotation 
    733 Returns true if @code{pos} is a liberty of the string at @code{str}. 
     747Returns true if @code{pos} is a liberty of the string at @code{str_pos}. Checks 
     748whether pos is a liberty. 
     749@end quotation 
     750@item @code{int liberty_of_string2(int pos, int str_pos)} 
     751@findex liberty_of_string2 
     752@quotation 
     753Returns true if @code{pos} is a liberty of the string at @code{str_pos}. 
     754@code{str_pos} must be a liberty. 
    734755@end quotation 
    735 @item @code{int second_order_liberty_of_string(int pos, int str)} 
     756@item @code{int second_order_liberty_of_string(int pos, int str_pos)} 
    736757@findex second_order_liberty_of_string 
    737758@quotation 
    738 Returns true if @code{pos} is a second order liberty of the string at str. 
     759Returns true if @code{pos} is a second order liberty of the string at 
     760@code{str_pos}. 
    739761@end quotation 
    740 @item @code{int neighbor_of_string(int pos, int str)} 
     762@item @code{int are_neighbors(int pos1, int pos2)} 
     763@findex are_neighbors 
     764@quotation 
     765Returns true if the empty vertex or the string at @code{pos1} is 
     766adjacent to the empty vertex or the string at @code{pos2}. 
     767@end quotation 
     768@item @code{int neighbor_of_string(int pos, int str_pos)} 
    741769@findex neighbor_of_string 
    742770@quotation 
    743 Returns true if @code{pos} is adjacent to the string at @code{str}. 
     771Returns true if @code{pos} is adjacent to the string at @code{str_pos}. 
    744772@end quotation 
    745773@item @code{int has_neighbor(int pos, int color)} 
    746774@findex has_neighbor 
    747775@quotation 
    748 Returns true if @code{pos} has a neighbor of @code{color}. 
     776Returns true if @code{pos} has a neighbor of color @code{color}. 
     777@end quotation 
     778@item @code{int find_neighbor(int pos, int color)} 
     779@findex find_neighbor 
     780@quotation 
     781If @code{pos} has exactly one neighbor of color @code{color} returns 
     782position of this neighbor. Otherwise returns -1. 
    749783@end quotation 
    750 @item @code{int same_string(int str1, int str2)} 
     784@item @code{int same_string(int str1_pos, int str2_pos)} 
    751785@findex same_string 
    752786@quotation 
    753 Returns true if @code{str1} and @code{str2} belong to the same string. 
     787Returns true if @code{str1_pos} and @code{str2_pos} belong to the same string. 
    754788@end quotation 
    755 @item @code{int adjacent_strings(int str1, int str2)} 
     789@item @code{int adjacent_strings(int str1_pos, int str2_pos)} 
    756790@findex adjacent_strings 
    757791@quotation 
    758 Returns true if the strings at @code{str1} and @code{str2} are adjacent. 
     792Returns true if the strings at @code{str1_pos} and @code{str2_pos} are adjacent. 
    759793@end quotation 
    760794@item @code{int is_ko(int pos, int color, int *ko_pos)} 
    761795@findex is_ko 
     
    777811Return true if @code{pos} is either a stone, which if captured would give 
    778812ko, or if @code{pos} is an empty intersection adjacent to a ko stone. 
    779813@end quotation 
     814@item @code{int is_superko_violation(int pos, int color, enum ko_rules type)} 
     815@findex is_superko_violation 
     816@quotation 
     817Return true if a move by @code{color} at @code{pos} is a superko violation 
     818according to the specified type of ko rules. This function does not 
     819detect simple ko unless it's also a superko violation. 
     820@end quotation 
    780821@item @code{int does_capture_something(int pos, int color)} 
    781822@findex does_capture_something 
    782823@quotation 
     
    797838Returns true if at least one move has been played at pos 
    798839at deeper than level @code{cutoff} in the reading tree. 
    799840@end quotation 
     841@item @code{void get_move_from_stack(int k, int *move, int *color)} 
     842@findex get_move_from_stack 
     843@quotation 
     844Retrieve a move from the move stack. 
     845@end quotation 
    800846@item @code{int stones_on_board(int color)} 
    801847@findex stones_on_board 
    802848@quotation