Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: potential checks

Author: Matthias Gemuh

Date: 00:11:47 04/16/03

Go up one level in this thread


On April 16, 2003 at 00:00:07, Mike Siler wrote:

>Up until recently, my chess program generated all pseudo-legal moves, made each
>move, checked to see if it's in check and unmakes the move if so. This annoyed
>me a bit because my attack function that sees if the program is in check was not
>too quick. So I came up with a method of avoiding calling the attack function as
>often. Assuming the program is not in check at this particular node, we know
>that there are only 2 ways the program can enter check: either the program moves
>a piece and discovers a check on itself (it was pinned to the king by a sliding
>piece) or the king moves into check. I wrote a function to determine which (if
>any) of the program's pieces are pinned to its king. Then if a pseudo-legal move
>involves the pinned piece, we know already that the movement will cause the king
>to be in check, so we don't have to call the time-consuming make_move function,
>attack function, or unmake_move function.
>
>Of course if the move involves the king, we can't skip the attack function.
>Using this method, I experienced a very nice speed-up: from about 300knps to
>about 375-400 knps.
>
>I've never seen another program that uses this. I'm just curious if there is
>some down side I don't see or if programs do use this and I just didn't notice.
>
>Michael


I do a partial MakeMake() and test for legality midway, then I partially
unmake and abort if illegal.

/Matthias.








This page took 0 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.