Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Position Storage

Author: Robert Hyatt

Date: 08:24:43 12/23/03

Go up one level in this thread


On December 23, 2003 at 00:52:37, KarinsDad wrote:

>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?

Yes, except I don't do 48 bit things for pawns..  I use 64 bits for everything
to give uniform square naming.

>
>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).

Again, when you say "position" what do you mean?  I am talking about the
internal chess board representation.  If you are talking about (say) book
positions, the answer would be different.  Hash table positions would be
different.  Etc...

>
>
>>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

I don't quite follow.  You need _one_ side to move bit, wtm=1, btm=0, for
the _entire_ position, not for each square.  It _really_ sounds like we
are talking about two different kinds of "positions"...


>
>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?

Speed to access them...




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.