James Edward Gray II wrote: > On Jun 20, 2005, at 3:56 PM, Jim Menard wrote: > >> I've been working on adding checkmate detection to my Bangkok-based >> solution from last week. I added check detection, which was easy. >> Checkmate seems harder, unless I'm missing something. I need to >> figure out all possible moves for all pieces on the checked side, >> then make the move and re-check the board to see if the king is still >> in check. Is that what I have to do, or am I without clue? > > > That's how I did it. I believe that's about the best method because > you have to consider things like moving a piece in to block the check. > > James Edward Gray II It would seem that the space of "all possible moves by all possible pieces" could be reduced greatly be examining whether or not a given "checked" piece could possibly move to a space that blocks an attack on the king by an attacking piece. A relatively small number of spaces meet this criteria compared to the size of the board, and a relatively small number of pieces are likely to meet the criteria. If the attacking piece were a knight or fairy, the possibility of moving a piece other than the king can be rejected out of hand, as can the case where two checking pieces simultaneously check the king. I could easily be missing something. Hasn't been a sharp week for me! But wait, it's only Monday... Cheers, Jim