BishopMask for MagicBitboard Implementation

Code, algorithms, languages, construction...
Post Reply
jayakiran
Posts: 4
Joined: Sat Apr 16, 2016 11:33 am

BishopMask for MagicBitboard Implementation

Post by jayakiran » Sat Apr 16, 2016 11:43 am

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

H.G.Muller
Posts: 190
Joined: Sun Jul 14, 2013 10:00 am
Real Name: H.G. Muller

Re: BishopMask for MagicBitboard Implementation

Post by H.G.Muller » Mon Apr 18, 2016 7:04 pm

Indeed, the masks are the same. Why do you think that would be a problem?

hyatt
Posts: 1242
Joined: Thu Jun 10, 2010 2:13 am
Real Name: Bob Hyatt (Robert M. Hyatt)
Location: University of Alabama at Birmingham
Contact:

Re: BishopMask for MagicBitboard Implementation

Post by hyatt » Mon Apr 18, 2016 9:54 pm

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.

jayakiran
Posts: 4
Joined: Sat Apr 16, 2016 11:33 am

Re: BishopMask for MagicBitboard Implementation

Post by jayakiran » Thu Apr 21, 2016 4:07 pm

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

Post Reply