Author: Gerd Isenberg
Date: 13:33:20 11/30/04
Go up one level in this thread
On November 30, 2004 at 12:51:38, Andrew N. Hunt wrote:
>Hi!
>
>I've recently implemented bitboards (standard and rotated) and have a question
>about pre-computing moves which contain blocked squares. Let's say I have the
>occupied rank:
>
>bQ, wN, _, wR, _, bP, bN, _
>
>and I want to find the valid moves for the white Rook. How do I handle modifying
>its bitboard rank: 11010110 to remove the blocked squares and only store the
>available squares: 01101100? (which I can then And with the white/black pieces
>to find valid Rook moves)
Additionally to the other posts i like to mention the x^(x-2) trick to generate
rank attacks in msb direction:
msb lsb
occupied 11010110
-attacker 00010000 (or &~attacker if attacker must not be a member of occupied)
11000110 => rook reset in occupied
-attacker 00010000
10110110 => get some bits from next borrow
^occupied 11010110
01100000 => attacks in msb direction
Whether this is the left or right direction depends on your bitboard mapping - i
call it right attacks. Similar to Steffan's Kogge-Stone algorithms this works
with multiple rooks on a rank too. To perform the rank- or bytewise trick with
the whole bitboard, one has to use SIMD instructions (vector of 8 bytes, eg.
MMX/SSE2 psubb) or a SWAR algorithm with some 0x00ff...00ff and 0xff00...ff00
masks.
Cheers,
Gerd
>
>Maybe I'm missing something obvious... :-?
>
>Many thanks!
>
>
>
>
>
>ah.
>
>--------------------------------------------------------------------=
>Andy Hunt
>Manager, Electronic Documentation
>Wolfram Research, Inc.
>Voice: 217-398-0700 ext.260; Fax: 217-398-0747
>Email: andy@wolfram.com; http://www.wolfram.com/
>--------------------------------------------------------------------=
>
>Power corrupts. Absolute power is kind of neat.
> -- John Lehman, Secretary of the Navy, 1981-1987
This page took 0.01 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.