magic move - bitboard orientation

Discussion of chess software programming and technical issues.

Moderators: Harvey Williamson, bob, hgm

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Post Reply
frankp
Posts: 228
Joined: Sun Mar 12, 2006 2:11 pm

magic move - bitboard orientation

Post by frankp » Sun Jun 01, 2008 9:20 am

I stumbled across magic move bitboards and the included the code by Pradyumma Kannan in my old program, as a quick hack. Since it did not work I guess the square mapping is important and mine
(for (sq = 0; sq < 64; sq++) bbSquare[sq] = bit << (63 - sq);)
incompatible. I assumed that the mapping would be equivalent to
(for (sq = 0; sq < 64; sq++) bbSquare[sq] = bit << (sq);),
but a simple remapping of my occupied bitboard before the call to the supplied macros does not yield the correct result. Did I miss something blindingly obvious?

Frank

Aleks Peshkov
Posts: 886
Joined: Sun Nov 19, 2006 8:16 pm
Location: Russia

Re: magic move - bitboard orientation

Post by Aleks Peshkov » Sun Jun 01, 2008 12:44 pm

Bishops and rooks are symmetrical in all directions, but your current position occupation bitboard parameter is not.

Pradu
Posts: 287
Joined: Sat Mar 11, 2006 2:19 am
Location: Atlanta, GA
Contact:

Re: magic move - bitboard orientation

Post by Pradu » Sun Jun 01, 2008 5:02 pm

frankp wrote:I stumbled across magic move bitboards and the included the code by Pradyumma Kannan in my old program, as a quick hack. Since it did not work I guess the square mapping is important and mine
(for (sq = 0; sq < 64; sq++) bbSquare[sq] = bit << (63 - sq);)
incompatible. I assumed that the mapping would be equivalent to
(for (sq = 0; sq < 64; sq++) bbSquare[sq] = bit << (sq);),
but a simple remapping of my occupied bitboard before the call to the supplied macros does not yield the correct result. Did I miss something blindingly obvious?

Frank
Try (R/B)magic(occ,sq^63) and see if that works. If not I'm not really sure. Could you post some sample calls for us to see?

frankp
Posts: 228
Joined: Sun Mar 12, 2006 2:11 pm

Re: magic move - bitboard orientation

Post by frankp » Sun Jun 01, 2008 5:25 pm

Thanks, (sq ^ 63) did the trick. Magic.

In the interim I have started rewriting and 'improving' my ancient code......

Post Reply