Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: potential checks

Author: Robert Hyatt

Date: 08:59:16 04/17/03

Go up one level in this thread


On April 16, 2003 at 00:51:37, Anthony Cozzie wrote:

>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 actually wrote something very similar today ;)
>
>However, I think I'm going to use Hyatts method of simply capturing the king.
>Since I have a get_check_evasions() routine, and I don't let the king move onto
>an attacked square, very few moves are actually illegal.
>
>anthony


I would not call that "Hyatt's method".  I do it that way, but it wasn't
original to me.
I did this in Cray Blitz.  I believe that chess 4.x did it also and that
predated Cray Blitz.
Earlier versions of my program (prior to cray blitz) did things completely
differently.

The only down-side here is I can't recall exactly who started the "pseudo-legal"
approach
to things using capturing the king as a legality refutation...

Most likely Dave Slate deserves the credit...




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.