Page 1 of 1

BishopMask for MagicBitboard Implementation

Posted: Sat Apr 16, 2016 11:43 am
by jayakiran
Hi -

I'm working on a chess engine with MagicBitBoard move generator. I have a question about BishopMask. I have seen that for this mask (as well as RookMask), we turn off the bits at the edge of the board. My question is, if we do that, bishops at opposite corners of the board will have the same Mask - for example a bishop at A1 or H8 will have the same Mask (or am I missing something?) - which is going to be a problem. So -

1. Is this expected?
2. Am I doing the BishopMask wrong?

Hope someone who knows this stuff can clarify. Thanks!

Jayakiran

Re: BishopMask for MagicBitboard Implementation

Posted: Mon Apr 18, 2016 7:04 pm
by H.G.Muller
Indeed, the masks are the same. Why do you think that would be a problem?

Re: BishopMask for MagicBitboard Implementation

Posted: Mon Apr 18, 2016 9:54 pm
by hyatt
jayakiran wrote:Hi -

I'm working on a chess engine with MagicBitBoard move generator. I have a question about BishopMask. I have seen that for this mask (as well as RookMask), we turn off the bits at the edge of the board. My question is, if we do that, bishops at opposite corners of the board will have the same Mask - for example a bishop at A1 or H8 will have the same Mask (or am I missing something?) - which is going to be a problem. So -

1. Is this expected?
2. Am I doing the BishopMask wrong?

Hope someone who knows this stuff can clarify. Thanks!

Jayakiran

Remember that a bishop attacks the last square on a diagonal if the dragonal is open, or if the corner squares are occupied. The attacked squares are the same.

Re: BishopMask for MagicBitboard Implementation

Posted: Thu Apr 21, 2016 4:07 pm
by jayakiran
Hi guys -

Thanks for the confirmation/explanation.

I initially thought that the mask should be different for different bishop/rook positions... Now that I think about it, there is no reason for that to be the case. What should be unique (ignoring good collisions) is the hash of each possible occupancy for a given rook/bishop position. Mixed them up.

Jayakiran