magic move - bitboard orientation

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

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

magic move - bitboard orientation

Post by frankp »

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: 892
Joined: Sun Nov 19, 2006 9:16 pm
Location: Russia

Re: magic move - bitboard orientation

Post by Aleks Peshkov »

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 3:19 am
Location: Atlanta, GA

Re: magic move - bitboard orientation

Post by Pradu »

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 3:11 pm

Re: magic move - bitboard orientation

Post by frankp »

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

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