Author: Tom Likens
Date: 20:34:10 01/22/02
Go up one level in this thread
Russell,
I think a better example would be the attack of a knight on the king.
Your example of a bishop attack leaves out the minor :) problem of
interposing pieces between the bishop and the king. Your test reveals
a *potential* attack on the king by an enemy bishop.
regards,
--tom
On January 22, 2002 at 20:21:45, Russell Reagan wrote:
[ snip ]
>>Sounds interesting. Could you elaborate, what bitboards are to be used, here?
>
>For example, you could have a bitboard containing the square of the king:
>
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 1 0 0 0
>king on e1
>
>And when you start your program it can generate some attack bitboards. For
>example:
>
>Bitboard bishop_attacks[64];
>
>And bishop_attacks would contain a bitboard for each square on the board, so the
>bitboard for a bishop on a5 would be:
>
>0 0 0 1 0 0 0 0
>0 0 1 0 0 0 0 0
>0 1 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 1 0 0 0 0 0 0
>0 0 1 0 0 0 0 0
>0 0 0 1 0 0 0 0
>0 0 0 0 1 0 0 0
>bishop on a5
>
>So you could just AND the bitboards together and if the result is non-zero, then
>the king is in check.
>
>if(bishop_attacks[A5] & white_king_bitboard) {
> // king is in check
>}
>
>Thanks for your post, it was very helpful!
>
>Russell
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.