Author: Russell Reagan
Date: 00:23:10 12/27/02
Go up one level in this thread
On December 27, 2002 at 02:57:11, Bruce Moreland wrote: >>if number of pieces giving check is 1 > >Calculating this number is difficult. Using bitboards it doesn't seem too difficult. Maybe it's not efficient (?), but it's not difficult. Something like... // Maybe not totally correct, but you get the idea (I hope) bitboard checkers = 0; checkers |= knightAttacks(kingSquare) & enemyKnights; checkers |= rookAttacks(kingSquare) & (enemyRooks | enemyQueens); checkers |= queenAttacks(kingSquare) & (enemyBishops | enemyQueens); checkers |= friendlyPawnAttacks(kingSquare) & enemyPawns; int numChecks = count(checkers); >> generate moves that capture the piece giving check >> generate moves that block the checking piece >>generate capture moves for king >>generate non-capture moves for king > >Or more generally, generate all moves for the king. Well, the seperation of king move generation was to prevent someone saying, "generating all king moves would include castling, and you can't castle out of check." Plus I have seperate move generators like that in my program. 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.