Author: Gerd Isenberg
Date: 13:08:12 02/23/06
Go up one level in this thread
On February 23, 2006 at 15:49:46, Dann Corbit wrote:
>On February 23, 2006 at 15:29:17, Gerd Isenberg wrote:
>
>>Sounds very interesting, Dann. Can you elaborate a bit more about the idea?
>>Do you mean a kind of rotated lookup with 7-bit distinct white/black occupied
>>states?
>
>For any given ray there are at most 128 possible states (7 bits, as you say)
>because we do not need to count the square on which we are standing.
>
>So, obvoiusly, a switch() with 128 labels can account for every possibility.
>Suppose you have a diagonal slider at e5.
>The labels will look like:
>
>switch case(masked_diagonal)
>case a1:
>/* do stuff */
>break;
>case a1b2:
>/* do stuff */
>break;
>
>...
>
>case h8:
>/* do stuff */
>break;
>
>default:
>assert(false);
>}
>
>Since you have at your disposal bitboards for every piece and for all white and
>for all black and for all chessmen of any color, you can precompute
>*everything*.
>
>The best thing about it (I think) is that the need for rotating the bitboards
>goes away completely (though your generator that computes the sliders is much
>easier if you use rotated bitboards for that). But the generator is not part of
>your chess program. It just writes four functions for each square on the
>chessboard.
>
>So (for instance) you might have a file called e5.cpp.
>
>Inside of e5.cpp, we will find methods e5p() {diagonal, e5 with + slope},
>e5m(){diagonal, e5 with - slope}, e5v() {e5 vertical} and e5h() {e5 horizontal}
>[Well, may as well toss in e5n() {e5 knights} etc.]
>
>There are (of course) other ways to organize it, and 64 files is a lot of files,
>but it's not like you have to do a lot of writing, since you write a single
>program to generate them.
>
>Is it clear?
No sorry, not exactly - or better not at all.
How are those generated functions called during movegeneration inside the chess
program? Do you have arrays of functions pointers indexed by squares and what
else?
May be i am to biased with the De Bruijn stuff ;-)
This page took 0.01 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.