Next: Corner Matcher, Previous: Joseki Compiler, Up: Patterns
As an example of how to use autohelpers with the Joseki compiler, we consider an example where a Joseki is bad if a ladder fails. Assume we have the taisha and are considering connecting on the outside with the pattern
--------+ ........| ........| ...XX...| ...OXO..| ...*O...| ....X...| ........| ........|
But this is bad unless we have a ladder in our favor. To check this we add a constraint which may look like
--------+ ........| ........| ...XX...| ...OXO..| ...*OAC.| ....DB..| ........| ........| ;oplay_attack(*,A,B,C,D)
In order to accept the pattern we require that the constraint on the semicolon line evaluates to true. This particular constraint has the interpretation "Play with alternating colors, starting with `O', on the intersections `*', `A', `B', and `C'. Then check whether the stone at `D' can be captured." I.e. play to this position
--------+ ........| ........| ...XX...| ...OXO..| ...OOXX.| ....XO..| ........| ........|
and call attack()
to see whether the lower `X' stone can be
captured. This is not limited to ladders, but in this particular case the
reading will of course involve a ladder.
The constraint diagram above with letters is how it looks in the .db file. The joseki compiler knows how to create these from labels in the SGF node. Cgoban has an option to create one letter labels, but this ought to be a common feature for SGF editors.
Thus in order to implement this example in SGF, one would add labels to the four intersections and a comment:
;oplay_attack(*,A,B,C,D)
The appropriate constraint (autohelper macro) will then be added to the Joseki .db file.