www.delorie.com/gnu/docs/gnugo/gnugo_149.html   search  
Buy GNU books!

GNU Go Documentation

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

12.7 Autohelper Functions

The autohelper functions are translated into C code by the program in `mkpat.c'. To see exactly how the functions are implemented, consult the autohelper function definitions in that file. Autohelper functions can be used in both constraint and action lines.


Number of first, second, third, and fourth order liberties of a worm respectively. See section 10. Worms and Dragons, the documentation on worms for definitions.


The number of liberties that an enemy or own stone, respectively, would obtain if played at the empty intersection `x'.


Calls cut_possible (see section 18.1 General Utilities) to determine whether `X' or `O' can cut at the empty intersection `x'.


True if `x' is either a stone or an empty point involved in a ko position.


The matcher status of a dragon. status(x) returns an integer that can have the values ALIVE, UNKNOWN, CRITICAL, or DEAD (see section 10. Worms and Dragons).


Each function true if the dragon has the corresponding matcher status and false otherwise (see section 10. Worms and Dragons).


Returns the status of the dragon at `x' (see section 10. Worms and Dragons).


The number of eyes of a dragon. It is only meaningful to compare this value against 0, 1, or 2.


Functions related to various kinds of influence and territory estimations, as described in See section 17. Moyo. xarea(x) evaluates to true if x is either a living enemy stone or an empty point within his "area". oarea(x) is analogous but with respect to our stones and area. The main difference between area, moyo, and terri is that area is a very far reaching kind of influence, moyo gives a more realistic estimate of what may turn in to territory, and terri gives the points that already are believed to be secure territory.


True for a dragon that is perceived as weak.


Results of tactical reading. attack(x) is true if the worm can be captured, defend(x) is true if there also is a defending move. Please notice that defend(x) will return false if there is no attack on the worm.


True if an enemy or friendly stone, respectively, can safely be played at `x'. By safe it is understood that the move is legal and that it cannot be captured right away.


True if an enemy or friendly stone, respectively, can legally be played at x.

o_somewhere(x,y,z, ...)
x_somewhere(x,y,z, ...)

True if O (respectively X) has a stone at one of the labelled vertices. In the diagram, these vertices should be marked with a `?'.


True if an own stone at `x' would stop the enemy from safely playing at `y', and conversely for the second function.


True if a move at `x' defends/attacks the worm at `y'. For defense a move of the same color as `y' is tried and for attack a move of the opposite color.


These functions make it possible to do more complex reading experiments in the constraints. All of them work so that first the sequence of moves `a',`b',`c',... is played through with alternating colors, starting with `X' or `O' as indicated by the name. Then it is tested whether the worm at `z' can be attacked or defended, respectively. It doesn't matter who would be in turn to move, a worm of either color may be attacked or defended. For attacks the opposite color of the string being attacked starts moving and for defense the same color starts. The defend functions return true if the worm cannot be attacked in the position or if it can be attacked but also defended. The attack functions return true if there is a way to capture the worm, whether or not it can also be defended. If there is no stone present at `z' after the moves have been played, it is assumed that an attack has already been successful or a defense has already failed. If some of the moves should happen to be illegal, typically because it would have been suicide, the following moves are played as if nothing has happened and the attack or defense is tested as usual. It is assumed that this convention will give the relevant result without requiring a lot of special cases.

The special label `?' can be used to represent a tenuki. Thus oplay_defend(a,?,b,c) tries moves by `O' at `a' and `b', as if `X' plays the second move in another part of the board, then asks if `c' can be defended. The tenuki cannot be the first move of the sequence, nor does it need to be: instead of oplay_defend(?,a,b,c) you can use xplay_defend(a,b,c).


These functions are similar to the previous ones. The difference is that the last *two* arguments denote worms to be attacked or defended simultaneously. Obviously `y' and `z' must have the same color. If either location is empty, it is assumed that an attack has been successful or a defense has failed. The typical use for these functions is in cutting patterns, where it usually suffices to capture either cutstone.

The function xplay_defend_both plays alternate moves beginning with an `X' at `a'. Then it passes the last two arguments to defend_both in `engine/utils.c'. This function checks to determine whether the two strings can be simultaneously defended.

The function xplay_attack_either plays alternate moves beginning with an `X' move at `a'. Then it passes the last two arguments to attack_either in `engine/utils.c'. This function looks for a move which captures at least one of the two strings. In its current implementation attack_either only looks for uncoordinated attacks and would thus miss a double atari.


These functions are used to set up a position like

.O.    .y.
OXO    xXz

and `X' aims at capturing at least one of `x', `y', and `z'. If this succeeds `1' is returned. If it doesn't, `X' tries instead to cut through on either side and if this succeeds, `2' is returned. Of course the same shape with opposite colors can also be used.

Important notice: `x', `y', and `z' must be given in the order they have in the diagram above, or any reflection and/or rotation of it.


Checks whether the string at `x' can attack any surrounding string. If so, return false as the move to create a seki (probably) wouldn't work.


Calls add_followup_value to add as a move reason a conservative estimate of the value of saving the string `x' by capturing one opponent stone.


Returns the number of stones in the area around `x'.


Returns the amount of space in the area around `x'.


True if `x' is an eye space for either color, a non-marginal eye space for either color, or a marginal eye space for either color, respectively.


Tell the move generation that `x' is a substandard move that never should be played.


Return true if `x' and `y' are the same dragon or worm respectively.


Number of stones in the indicated dragon or worm.


Explicitly notify the move generation about move reasons for the move in the pattern.


Returns true if the empty intersection at `x' is a half eye.


Inform the tactical reading that a supposed attack does in fact not work.


True if cutstone2 field from worm data is larger than one. This indicates that saving the worm would introduce at least two new cutting points.


Prevents the misreporting of `x' as lunch for `y'. For example, the following pattern tells GNU Go that even though the stone at `a' can be captured, it should not be considered "lunch" for the dragon at `b', because capturing it does not produce an eye:

XO|          ba|
O*|          O*|
oo|          oo|
?o|          ?o|

> not_lunch(a,b)


Calls vital_chain to determine whether capturing the stone at `x' will result in one eye for an adjacent dragon. The current implementation just checks that the stone is not a singleton on the first line.


Amalgamate (join) the dragons at `x' and `y' (see section 10. Worms and Dragons).


Called when `x', `y', `z' point to three (preferably distinct) dragons, in situations such as this:


In this situation, the opponent can play at `*', preventing the three dragons from becoming connected. However `O' can decide which cut to allow. The helper amalgamates the dragon at `y' with either `x' or `z', whichever is largest.


This autohelper should be called when `x' is an eyespace which is misidentified as marginal. It is reclassified as a proper eyespace (see section 11.2 Eye spaces).


Remove a half eye from the eyespace. This helper should not be run after make_dragons is finished, since by that time the eyespaces have already been analyzed.


Remove an eye point. This function can only be used before the segmentation into eyespaces.


Here `x' is an empty intersection which may be an eye or half eye for some dragon, and `y' is a stone of the dragon, used only to determine the color of the eyespace in question. Returns the sum of the values of the diagonal intersections, relative to `x', as explained in See section 11.7 Topology of Half Eyes and False Eyes, equal to 4 or more if the eye at `x' is false, 3 if it is a half eye, and 2 if it is a true eye.


Returns the escape value at `x'. This is only useful in owl attack and defense patterns.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003