Author: Frederik Tack
Date: 17:14:21 11/11/05
Go up one level in this thread
On November 11, 2005 at 19:50:18, Ryan B. wrote: >On November 11, 2005 at 19:13:06, Frederik Tack wrote: > >>A few months ago, i started writing a chess engine in Delphi. I chose to use a >>pseudo-legal movegenerator for performance reasons. In order to detect a >>checkmate, i just check if the king is captured and this works fine. I'm now >>trying to figure out how to detect a stalemate, but i haven't found an easy way >>to do this yet. The problem is that when the king is captured, the program is >>already two plies deeper in the search tree then the node where a possible >>stalemate could have happened. >>So far, the best idea i have come up with is the following : In opening or >>mid-game positions, the chances of a stalemate are pretty much non-existing. So >>for opening and mid-game, i can use the pseudo-legal move generator without a >>problem. For end-games, i could switch to a legal move generator. The only >>difficulty here is to find to best moment in game to switch to the legal move >>generator. >>I wonder if any1 else has had the same problem and found an easy way to detect >>stalemates with a pseudo-legal move generator? If so, any suggestion would be >>most welcome. > >I do not think thing waiting until king capture is a good way to detect CM. I >am sure it will help a lot later to have an incheck function and it is a good >idea to know how many legal moves you have. if (incheck && legal_moves == 0) CM >else if (legal_moves == 0) draw. I already have an 'incheck' function. I use it to check if it is allowed to castle for example. The problem is that when i use 'incheck' to produce legal moves instead of pseudo-legal moves, i get a 30% performance decrease. That's a lot for detecting a simple stalemate. Especially since a stalemate can only happen in endgame positions. I haven't encountered any other problems that would require legal move generation to get resolved. So i really would like to keep on using pseudo-legal moves. Tx for the reply anyway.
This page took 0.01 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.