Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Detecting stalemate with a pseudo-legal movegenerator?

Author: Ryan B.

Date: 16:50:18 11/11/05

Go up one level in this thread


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.



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.