Next: Autohelper Functions, Previous: Autohelpers and Constraints, Up: Patterns
As a complement to the constraints, which only can accept or reject a pattern, one can also specify an action to perform when the pattern has passed all tests and finally has been accepted.
Example:
Pattern EJ4 ...*. continuation .OOX. ..XOX ..... ----- :8,Ed,NULL ...*. never play a here .OOX. .aXOX ..... ----- >antisuji(a)
The line starting with `>' is the action line. In this case it tells the move generation that the move at a should not be considered, whatever move reasons are found by other patterns. The action line uses the labels from the constraint diagram. Both constraint and action can be used in the same pattern. If the action only needs to refer to `*', no constraint diagram is required. Like constraints, actions can span multiple lines.
Here is a partial list of the autohelper macros which are typically called from action lines. This list is not complete. If you cannot find an autohelper macro in an action line in this list, consult mkpat.c to find out what function in the engine is actually called. If no macro exists which does what you want, you can add macros by editing the list in mkpat.c.
antisuji(a);
Mark `a' as an antisuji, that is, a move that must never be played.
replace(a,*)
This is appropriate if the move at `*' is definitely better than the move at `a'. The macro adds a point redistribution rule. Any points which are assigned to `a' during the move generation by any move reason are redistributed to `*'.
prevent_attack_threat(a)
Add a reverse followup value because the opponent's move here would threaten to capture `a'.
threaten_to_save(a)
Add a followup value because the move at `*' threatens to rescue the dead string at `a'.
defend_against_atari(a)
Estimate the value of defending the string `a' which can be put into atari and add this as a reverse followup value.
add_defend_both_move(a,b);
add_cut_move(c,d);
Add to the move reasons that the move at `*' threatens to cut `c' and `d'.