Next: , Previous: Autohelper Functions, Up: Patterns


9.8 Attack and Defense Database

The patterns in attack.db and defense.db are used to assist the tactical reading in finding moves that attacks or defends worms. The matching is performed during make_worms(), at the time when the tactical status of all worms is decided. None of the classes described above are useful in these databases, instead we have two other classes.

`D'
For each `O' worm in the pattern that can be tactically captured (worm[m][n].attack_code != 0), the move at `*' is tried. If it is found to defend the stone, this is registered as a reason for the move `*' and the defense point of the worm is set to `*'.
`A'
For each `X' worm in the pattern, it's tested whether the move at `*' captures the worm. If that is the case, this is registered as a reason for the move at `*'. The attack point of the worm is set to `*' and if it wasn't attacked before, a defense is searched for.

Furthermore, `A' patterns can only be used in attack.db and `D' patterns only in defense.db. Unclassified patterns may appear in these databases, but then they must work through actions to be effective.