Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Position Storage

Author: KarinsDad

Date: 21:52:37 12/22/03

Go up one level in this thread


On December 23, 2003 at 00:15:44, Robert Hyatt wrote:

>On December 22, 2003 at 23:39:08, KarinsDad wrote:
>
>>What structure do people use in their programs to store a position?
>
>
>A chess board -> a position?
>
>12 bit boards, one for each piece type.

Sorry for being dense, but I do not quite follow this.

So, each piece bit board is the normal 64 bits (except the pawns which are 48
bits) or 8 bytes (8 bit byte machine) * 10 piece types + 6 bytes * 2 piece types
= 92 bytes?

Isn't there additional information needed like side to move, rook castle
possibility, and e.p. pawn? I guess if you stored the pawns as normal 64
bitboards, you could fill in the extra 8 bits on either end with this data, but
then you would have 96 bytes. Or, you could just add another two bytes for 94
bytes. It seems like a lot of data per position though (if you have data
persistence).


>An array of 64 elements (or more) one for each square.

Each element would need the 4 bit piece (e.p. pawn, castle rook, side to move
king, empty, and white and black for 6 piece types). 64 elements * 4 bits = 32
bytes

Is this correct? Or is side to move known from even or odd depth in the graph
and that "piece" is replaced with something else?


>In theory you could define a position as a 32 element array, one for each
>possible piece, telling what the piece is and what square it is on.  But this
>has not been used in a _long_ time so far as I know, as it is too slow to deal
>with.
>
>I'm sure you could create others.  But probably none would be any better than
>one of the first two I mentioned.]


Why are these better than other methods?





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.