In a previous post I discovered that chess is the ultimate trap. You might think that that leads to a simple algorithm which closes the trap. Just take away as much squares as possible from your opponent's pieces and you're done.
Matters are somewhat more complicated, though. As I stated in my previous post, you are dealing with a cage. A cage with walls that are closing in on the hostile piece. This are the problems to be solved:
- The walls of the cage have a freakish shape.
- The walls constitue of many different elements like the rim, own pieces, hostile pieces, covered squares and tempo's.
- The walls are partly invisible.
- The fabric of a wall can be made of tempo's. That means there are holes in the wall but the opponent cannot make use of it since it takes too many tempo's to walk through it so you can close it in time.
- The pieces that form the walls have to cooperate in order to close in.
- The walls can be attacked.
- Only cages that you can shrink to zero squares do really matter.
I will not start with such complexity though. I start more simple with an algorithm to mate the king with two rooks in an attempt to optimize the coordinating of the pieces. I will not bore you with the details.