Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: RankAttacks with x^(x-2)

Author: Gerd Isenberg

Date: 12:32:22 09/30/02

Go up one level in this thread


On September 30, 2002 at 14:56:11, Peter Fendrich wrote:

>On September 30, 2002 at 14:34:48, Gerd Isenberg wrote:
>
>>Hi all,
>>
>>i recently thought about and played with the x^(x-2) idea, introduced to me by
>>"The Hyperbola Project" some time ago. It works fine with bit 0, and i thought
>>that shifting to file zero is required, before generationg the attacks.
>>But that seems not to be necessary. The generalized term for one rank is simply
>>
>>    Occupied ^ (Occupied - 2*RookMover)
>>
>>where RookMover is subset of Occupied.
>>
>>This term produces all rank attacks of all RookMover in positve direction
>>(increasing file index, here A=0,8...;B=1,9...).
>>
>>What a surprise (at least for me)!
>>
>>sample rank (consider the reversed bit order due to bit0 is A):
>>BitIndex     01234567
>>Occupied(O)  01011101
>>RookMover(R) 01001000
>> 2*R         00100100
>>-2*R         00111011
>>Occupied(O)  01011101
>>  (O-2R)     01101001
>>O^(O-2R)     00110100
>>
>>
>>With 64-bit mmx-registers this can be done simultaniously with all eight ranks:
>>
>>input:  mm1 = RookMover subset of Occupied
>>             (may be forced by "por mm6,mm1")
>>        mm6 = Occupied
>>output: mm0 = (right)RookAttacks
>>
>>  movq  mm0, mm6 ; Occupied
>>  psubb mm0, mm1 ; Occupied -   RookMover
>>  psubb mm0, mm1 ; Occupied - 2*RookMover
>>  pxor  mm0, mm6 ; Occupied ^ (Occupied - 2*RookMover)
>>
>>I tried it with up/down Kogge-Stone and leftDumb7Fill.
>>But only a few percent better performance (24secs instead of 26secs /10**9).
>>With pure dumb7fill, the performance win was even less. The seven unrolled
>>fill-iterations with four independent mmx-instructions are not so much slower
>>than with three for the remaining directions.
>>
>>Cheers,
>>Gerd
>
>Hi Gerd,
>Will you publish your algorithms somewhere or maybe you already have?
>Peter

Hi Peter,
Yes, but not my algorithms. Steffan Westcott gave me some lessions here about
floodfill and Kogge-Stone. I published some mmx-implementations. I am seriously
thinking about using this kind of sliding piece attack generation in IsiChess
(hammer version?). There are a lot of ideas to gain from generating attacks
simultaniously for a set of pieces of one kind, even for black and white
simultaniously with PIV's or Hammers SSE2 with 128-bit XMM-registers. No lookup
tables and no need of rotated bitboards. But after my private "x^(x-2)"
observation im not so sure anymore about the rotated.

Gerd

http://www.talkchess.com/forums/1/message.html?253968




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.