Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: To Mr Wegner. Exposition and question.

Author: Zach Wegner

Date: 07:36:53 12/10/03

Go up one level in this thread


On December 09, 2003 at 11:04:21, Maurizio Di Vitto wrote:

>Dear Mr Wegner,
>Thanks again for your time. I would like to show (following your instruction)
>how I initialized the two bitboards and I have a question:
>
>Rank_attack[64][256]
>
>I memorize the state in a bitboard(keep_value) and shift this value to the rank
>of the square( keep_value=state<<8*Rank(square) ):
>
>State=3
>Square=27(fourth rank=3)
>keep_value=state<<8*Rank(square)
>
>keep_value:
>
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 1 1
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>
>then I  create a bitboard m with the square:
>
>m|=mask[square]
>little question:
>m=mask[square] is the same?
>So I have:
>
>m:
>
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 1 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>
>rank=row[square]=3
>right=1;
>left=1;
>while m&keep_value==0 and m==1 and row[square-right]=rank
                           ^^^^
I'm not sure what the above is doing. What is it for?

>	m>>1
>	rank_attack[square][state]|=m;
>	right++
>
>(the same for left)

This is correct, but keep_value should not have m in it originally. As you
correctly deduced below, some states will never be used. This means that correct
states will always have the square set, and will break out of the loop before it
starts because m&keep_value will always be non-zero.

>file_attack[64][256]:
>
>I memorize the state in keep_value, but I will shift to put this value on the
>rank of the rotated square:
>
>State=3
>Square=17
>Non-rotated square(normal square)
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 1 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>
>keep_value:
>
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 1 1
>0 0 0 0 0 0 0 0
>
>then m will have the rotated square:
>
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 1 0 0 0 0 0
>0 0 0 0 0 0 0 0
>
>rank=row[rotated square]=1
>right=1
>left=1
>up=8
>down=8
>
>while m&keep_value==0 and m==1 and row[rotated square-right]==rank
>m>>1
>file_attack[square][state]|=mask[square+up]
>right++;
>up+=8;
>……………..
>Is it a right way?

Yes, although you don't need to rotate the square. You could put keep_value as
0 0 0 0 0 0 1 0
0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
and shift m by 8 each time. Then the test could be file[square+up]==file.

>The biggest question is: if the state is 3 and the square is
>1, you’ll have:
>state
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 1 1
>
>square
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 0 0
>0 0 0 0 0 0 1 0
>
>so I deduce that you’ll never calculate all the 256 for each square. Is it
>right.

Correct. state should have the square cleared, so it would look like this:

0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1

>Thank you again for your time.
>Maurizio Di Vitto

No problem.

Regards,
Zach



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.