Posted on 2006-05-21
How do I programmatically detect checkmate in chess? I can't think of any shortcuts. To detect it I would just have to:
1. see if there's a way to capture the piece that has the king in check
2. for non-knight pieces, look at every square along the path of check and see if it's possible to move a piece into that path without opening a path that results in check again.
3. see if there are any open spaces around the king which are not currently in check.
If I have to do it that way, am I missing anything?