Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Must I do KingInCheck after every move when using BitBoards ?

Author: Robert Hyatt

Date: 18:42:54 07/24/00

Go up one level in this thread


On July 24, 2000 at 19:16:01, Larry Griffiths wrote:

>On July 24, 2000 at 17:51:37, Robert Hyatt wrote:
>
>>
>>Think about this:  99%+ of all moves are perfectly legal.  Do you want to
>>do the incheck test on them to make sure they are legal, which means you do
>>the incheck test for 100% of your moves.  Or do you want to do the "I capture
>>a king to prove your last move was illegal" which only happens 1% of the
>>time.
>>
>>_that_ is the efficiency issue I mentioned.
>>
>>If you use null move you have to be careful, because null move will certainly
>>fail high if you are mated. :)
>>
>
>What I see Bob, is spinning through a piece list at the ply following a move
>generating all capture moves and then searching to see if one of the pieces
>captured was a King, and if so returning the move is illegal.

You can do that efficiently.  At the next ply, generate the moves.  Now you
want winning captures first, right?  so analyze the material gain, and
simply set your piece values so the king is _huge_.  That will make it pop
to the top of the list.  Now all you do is after sorting the moves, see if
a king is the first piece being captured.  If so, return your special value.
If not, return the move to try...

I do this in my q-search and never check for "in check" there.  I do check
for legality in my normal search, as the null-move will embarass you if you
don't..




>
>My current method does not go to the next ply if the king is in check and is
>done after each move is made.
>
>If I move my incheck routine to the next ply and say "is the opponents king in
>check" then return your last move is illegal, then it is only a matter of the
>efficiency of spinning thru a piece list generating all capture moves and
>searching for a king capture VS. using bitboards to see if the king is in check.
>
>Am I still missing something here ?
>
>Larry.



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.