Author: Steffan Westcott
Date: 16:29:55 10/15/02
Go up one level in this thread
Gerd, For generating the "all attacked squares" bitboard, you approach is fine. However, you may also want to generate moves (or square control info, SEE inputs etc.) at the same time, or at least keep some useful side results to generate the moves later. My suggestion is to generate move lists as a collection of bitboards, where each has set bits corresponding to destination squares for particular move types. The trick is to do this such that determining the source square or moving piece type (useful for SEE) is trivially known beforehand or very cheaply calculated when required. In my example, I presented calculation of upward rook moves. Note that only 1 rook may move upward to a given square. So, given a destination square, finding the _unique_ source square (the _unique_ moving rook) is a bit easier than starting off with "allRookAttacks" which has no move direction information (not to mention the possibility of several rooks able to move to the destination square : Lots of conditional branching...). Keeping track of which moves you've searched easy too - Just reset a single bit in the destination square bitboard. To generate an "all attacked squares" bitboard, simply OR the various final bitboards together (RookAttacksUp | RookAttacksDown | ...). By doing these bitwise ORs early as part of your fundamental routines, you are losing information on the type and direction of the moving pieces. Cheers, Steffan
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.