That's what I was saying. If the `l' at the end of the constant confused you, just ignore it: It's just C syntax for "long constant".
I think it should return 0x4000000000000000 which I'm interpreting that the horizontal mill for square 1 is closed.
Ooops! It returns 0x4000000000000000l, of course. Sorry about that.
Using the same concept, is it possible to determine:
1. if mills are open (1 square is still empty, 2 owned by the player)
2. if mills are blocked (2 squares owned by the player, 1 by the opponent)
You can create a table of 24 numbers that contains bitboards indicating the adjacent squares for each square.
3. get adjacent squares for a square
4. get empty squares
long empties = ~(bitboard|birboard);
No, I am sure you can work around that.
And if this would be possible, I'm assuming that shifting bits needs to be done and it wouldn't work on signed values.
Try to write code to solve one of these problems (say, find blocked mills). If you can't figure it out, ask again and I'll post some code.
EDIT: If you are going to perform all these other operations as well, I would forget about the trick of initializing the counters to 1, because it will complicate matters. So initialize to 0 instead, and now checking for mills becomes
long mills = (magic_sum + 0x1111111111111111l) & 0x4444444444444444l;
Edited by Álvaro, 13 March 2013 - 09:09 AM.