Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Fast check detection in bitboard engine

Author: Robert Hyatt

Date: 13:40:45 12/10/03

Go up one level in this thread


On December 10, 2003 at 16:14:11, Gerd Isenberg wrote:

>On December 10, 2003 at 15:38:43, Robert Hyatt wrote:
>
>>On December 10, 2003 at 12:54:13, Romang Jean-Francois wrote:
>>
>>>Hello,
>>>
>>>Is there a fast technique to detect that a king is in check in a bitboard engine
>>>? In my engine I generate all capture moves and try them to see if the king can
>>>be captured...but this seems very slow !
>>
>>Do it backward.  Find the king.  Ask does a knight on this square attack
>>a square that contains a knight?  If so that knight is checking the king.
>>Repeat for all your different piece types.
>>
>>
>>>
>>>I use check detection mainly in two parts of the engine :
>>>- During move generation to avoid generating illegal moves
>>>- To activate check extensions
>>>
>>>Is there a way to avoid check detection during move generation ?
>>
>>Don't do it.  When you go to the next ply, and you capture a king there,
>>return a special score to the previous ply that says "that move was
>>illegal, unmake it and try something else."
>
>you really generate and even try all pseudo-legal moves if in check?

No.  If I know I am in check to start with, I have a GenerateCheckEvasions()
generator that only generates legal moves out of check.  Avoids the high
overhead of making each illegal move and advancing to the next ply to
generate captures to refute them...


>
>>
>>>
>>>Thank you :)
>>>Jean-Francois



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.