Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: 0x88

Author: Louis Verhaard

Date: 02:30:00 01/12/99

Go up one level in this thread



On January 12, 1999 at 04:26:42, Bruce Moreland wrote:

>On January 12, 1999 at 03:55:37, Louis Verhaard wrote:
>
>>My chess program "Houdini" (which would be a respectable member of the
>>"U2000 club") uses another way to represent the board:
>> it is an array of 65 ints, 0 meaning
>>"the illegal square", and the other ones the real squares.
>>Arrays North, South, NorthWest, etc get you to the next rank, file, etc.
>>(North[A8] would give the illegal square). KnightMoves gives the list
>>of squares that can be reached by a knight from a certain square.
>>Other arrays give the file, rank, diagonal, etc. of a certain square.
>
>If you are using C it is more fun to zero-base your arrays, so you'd use either
>-1 or 64 as illegal values, typically.
>
>>Two-dimensional arrays can be used for representing other static properties
>>about the relations between two squares, for exampe there is
>>a KingDistance array that gives the "king distance" between two squares,
>>and there is another array "Direction" that tells how two squares are related
>>to each other (for example Direction[A1][G7] gives "NorthEast".
>
>This is a big honking array, it's 4096 elements.  You can do this with 0x88 in
>255 elements, and it is not a two-dimensional array.
>
>>An advantage of this representation is that the number of squares is
>>quite small, which makes the arrays quite small, so in principle you
>>can easily make more complex arrays,
>>like "can piece P on square A attack square B" (on an empty board),
>>although I don't use such arrays.
>
>You get this with a 255-byte array using 0x88.

Thanks for your reaction!

I understand the advantage of 0x88 now. You can very efficiently
represent properties that are only dependent on the relative position
of two or more squares, like the ones in the given examples.

For properties that depend on the absolute position on the board (like
storing 3-piece endgame data bases) 0x88 would be useless, but
then you just switch to another data representation.

On the other hand, 4096 bytes (or even 52K) may be a lot more than
256 bytes, but on a modern PC this is all peanuts, so I'll keep my
program as it is...

Louis



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.