BishopMask for MagicBitboard Implementation

Code, algorithms, languages, construction...

BishopMask for MagicBitboard Implementation

Postby 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
jayakiran
 
Posts: 4
Joined: Sat Apr 16, 2016 11:33 am

Re: BishopMask for MagicBitboard Implementation

Postby 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?
H.G.Muller
 
Posts: 179
Joined: Sun Jul 14, 2013 10:00 am

Re: BishopMask for MagicBitboard Implementation

Postby 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.
hyatt
 
Posts: 1242
Joined: Thu Jun 10, 2010 2:13 am
Location: University of Alabama at Birmingham

Re: BishopMask for MagicBitboard Implementation

Postby 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
jayakiran
 
Posts: 4
Joined: Sat Apr 16, 2016 11:33 am


Return to Programming and Technical Discussions

Who is online

Users browsing this forum: No registered users and 1 guest

cron