Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: 0x88 and move generator speed

Author: Miguel A. Ballicora

Date: 14:06:20 01/30/01

Go up one level in this thread


On January 30, 2001 at 14:47:08, Alvaro Jose Povoa Cardoso wrote:

>On January 29, 2001 at 09:08:59, José Carlos wrote:
>>Could you (or someone else) please give me an overview of the basic principles
>of an 0x88 move generator?
>Sorry for this novice question.
>
>Alvaro Cardoso

You have a board of 128 squares rather than 64. It is 16x8, ranks 1-8 but you
have 16 columns. Of course, the last 8 columns you never use but this array
is useful to detect when a piece goes out of bounds.

You declare the board like

unsigned char board [128];

How to detect if a piece is out of the board?
For instance, when you check all the squares that a bishop can go,
in one direction you loop doing  square = square + 9;
Then you take that square and if (square&0x88!=0) then the bishop just went out
of the legal board.
The trick is that in an array like this, a "legal" square
is determined by the following bits = 01110111, when you are out of the board
either of these bits = 10001000 could be set. You detect it with (square&0x88).
0x88 is in hexadecimal the equivalent of the binary number 10001000.

Regards,
Miguel




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.