Previous: The Owl Code, Up: Pattern Based Reading


12.2 Combination reading

It may happen that no single one of a set of worms can be killed, yet there is a move that guarantees that at least one can be captured. The simplest example is a double atari. The purpose of the code in combination.c is to find such moves.

For example, consider the following situation:

     
     +---------
     |....OOOOX
     |....OOXXX
     |..O.OXX..
     |.OXO.OX..
     |.OX..OO..
     |.XXOOOXO.
     |..*XXOX..
     |....XOX..
     |.XX..X...
     |X........
     

Every `X' stone in this position is alive. However the move at `*' produces a position in which at least one of four strings will get captured. This is a combination.

The driving function is called atari_atari because typically a combination involves a sequence of ataris culminating in a capture, though sometimes the moves involved are not ataris. For example in the above example, the first move at `*' is not an atari, though after `O' defends the four stones above, a sequence of ataris ensues resulting in the capture of some string.

Like the owl functions atari_atari does pattern-based reading. The database generating the attacking moves is aa_attackpats.db. One danger with this function is that the first atari tried might be irrelevant to the actual combination. To detect this possibility, once we've found a combination, we mark that first move as forbidden, then try again. If no combination of the same size or larger turns up, then the first move was indeed essential.