Author: Gerd Isenberg
Date: 14:13:29 01/14/03
Go up one level in this thread
On January 14, 2003 at 16:09:57, Dann Corbit wrote:
>[SNIP]
>>the x^x-2 trick is absolutely great.
>
>Can someone give me the ten cent explanation of how a parabola is useful?
>
>I want to get either a mathematical or geometric understanding.
Hi Dann,
One of the miracles of two's complement ;-)
Complementing bits in MSB direction until the first "one" is complemented.
One sample of all rook attacks in right board direction:
(bottom left is bit 0)
X - any Piece
R - Rook (or Queen)
- - - - - - - -
- - - - - - - -
- - - - - - - -
- X - R - - X -
- - - - - - - -
- R X - R - X -
- - - - - - - -
R - - - - - - -
BitBoards: - is zero for better reading. All operations byte- or rankwise.
0 1 2 3 4 5 6 7
Occupied Rooks Occupied-Rooks Occupied-2Rooks...^Occupied
- - - - - - - -|- - - - - - - -|- - - - - - - -|- - - - - - - -|- - - - - - - -
- - - - - - - -|- - - - - - - -|- - - - - - - -|- - - - - - - -|- - - - - - - -
- - - - - - - -|- - - - - - - -|- - - - - - - -|- - - - - - - -|- - - - - - - -
- 1 - 1 - - 1 -|- - - 1 - - - -|- 1 - - - - 1 -|- 1 - 1 1 1 - -|- - - - 1 1 1 -
- - - - - - - -|- - - - - - - -|- - - - - - - -|- - - - - - - -|- - - - - - - -
- 1 1 - 1 - 1 -|- 1 - - 1 - - -|- - 1 - - - 1 -|- 1 - - 1 1 - -|- - 1 - - 1 1 -
- - - - - - - -|- - - - - - - -|- - - - - - - -|- - - - - - - -|- - - - - - - -
1 - - - - - - -|1 - - - - - - -|- - - - - - - -|1 1 1 1 1 1 1 1|- 1 1 1 1 1 1 1
x 1 x-1 x-2 x^(x-2)
Cheers,
Gerd
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.