Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualÁlvaro

Posted 13 March 2013 - 09:09 AM


Ooops! It returns 0x4000000000000000l, of course. Sorry about that.

I think it should return 0x4000000000000000 which I'm interpreting that the horizontal mill for square 1 is closed.


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".
 

Using the same concept, is it possible to determine:

1. if mills are open (1 square is still empty, 2 owned by the player)

Yes.

2. if mills are blocked (2 squares owned by the player, 1 by the opponent)

Yes.

3. get adjacent squares for a square

You can create a table of 24 numbers that contains bitboards indicating the adjacent squares for each square.

4. get empty squares

  long empties = ~(bitboard[0]|birboard[1]);

5. etc....

Basically, yes.

And if this would be possible, I'm assuming that shifting bits needs to be done and it wouldn't work on signed values.

No, I am sure you can work around that.

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;

#4Álvaro

Posted 13 March 2013 - 09:02 AM


Ooops! It returns 0x4000000000000000l, of course. Sorry about that.

I think it should return 0x4000000000000000 which I'm interpreting that the horizontal mill for square 1 is closed.


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".
 

Using the same concept, is it possible to determine:

1. if mills are open (1 square is still empty, 2 owned by the player)

Yes.

2. if mills are blocked (2 squares owned by the player, 1 by the opponent)

Yes.

3. get adjacent squares for a square

You can create a table of 24 numbers that contains bitboards indicating the adjacent squares for each square.

4. get empty squares

  long empties = ~(bitboard[0]|birboard[1]);

5. etc....

Basically, yes.

And if this would be possible, I'm assuming that shifting bits needs to be done and it wouldn't work on signed values.

No, I am sure you can work around that.

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.

#3Álvaro

Posted 13 March 2013 - 09:02 AM


Ooops! It returns 0x4000000000000000l, of course. Sorry about that.

I think it should return 0x4000000000000000 which I'm interpreting that the horizontal mill for square 1 is closed.


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".
 

Using the same concept, is it possible to determine:

1. if mills are open (1 square is still empty, 2 owned by the player)

Yes.

2. if mills are blocked (2 squares owned by the player, 1 by the opponent)

Yes.

3. get adjacent squares for a square

You can create a table of 24 numbers that contains bitboards indicating the adjacent squares for each squares.

4. get empty squares

  long empties = ~(bitboard[0]|birboard[1]);

5. etc....

Basically, yes.

And if this would be possible, I'm assuming that shifting bits needs to be done and it wouldn't work on signed values.

No, I am sure you can work around that.

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.

#2Álvaro

Posted 13 March 2013 - 09:01 AM


Ooops! It returns 0x4000000000000000l, of course. Sorry about that.

I think it should return 0x4000000000000000 which I'm interpreting that the horizontal mill for square 1 is closed.


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".
 

Using the same concept, is it possible to determine:

1. if mills are open (1 square is still empty, 2 owned by the player)

Yes.

2. i
f mills are blocked (2 squares owned by the player, 1 by the opponent)

Yes.

3. get adjacent squares for a square

You can create a table of 24 numbers that contains bitboards indicating the adjacent squares for each squares.

4. get empty squares

  long empties = ~(bitboard[0]|birboard[1]);

5. etc....

Basically, yes.

And if this would be possible, I'm assuming that shifting bits needs to be done and it wouldn't work on signed values.

No, I am sure you can work around that.

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.

#1Álvaro

Posted 13 March 2013 - 09:01 AM

Ooops! It returns 0x4000000000000000l, of course. Sorry about that.[/quote]
I think it should return 0x4000000000000000 which I'm interpreting that the horizontal mill for square 1 is closed.[/quote]

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".

Using the same concept, is it possible to determine:

1. if mills are open (1 square is still empty, 2 owned by the player)

Yes.

2. i

f mills are blocked (2 squares owned by the player, 1 by the opponent)


Yes.

3. get adjacent squares for a square


You can create a table of 24 numbers that contains bitboards indicating the adjacent squares for each squares.

4. get empty squares

  long empties = ~(bitboard[0]|birboard[1]);

5. etc....


Basically, yes.

And if this would be possible, I'm assuming that shifting bits needs to be done and it wouldn't work on signed values.


No, I am sure you can work around that.

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.



PARTNERS