Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Thoughts about board representations...

Author: Robert Hyatt

Date: 19:33:38 02/12/00

Go up one level in this thread


On February 11, 2000 at 14:13:22, Dave Gomboc wrote:

>On February 11, 2000 at 13:38:27, Andrew Dados wrote:
>
>>On February 11, 2000 at 13:23:28, Tom Kerrigan wrote:
>>
>>>Interesting...
>>>
>>>I didn't think much about condensing the lists.
>>>
>>>It seems like you can have 16 pieces if nothing gets captured and all your pawns
>>>promote. And you can have 8 pawns.
>>>
>>>So I was going to do my piece list like this:
>>>
>>>int piece_list[52];
>>>
>>>piece_list[0] is a 0-terminated list of white pieces.
>>>piece_list[17] is a 0-terminated list of white pawns.
>>>etc.
>>>
>>>Comments?
>>>
>>>-Tom
>>
>>Note you don't need to have first pawn entry at fixed slot; you can determine
>>that number just before search. Keeping pawnlist and piecelist together as one
>>gets you to write one loop instead of two in many places...
>>-Andrew-
>
>So using half-open ranges:
>
>piece_start = a;
>piece_end = pawn_start = b;
>pawn_end = c;
>
>now you can
>
>// just pieces
>for (blah = piece_start; blah < piece_end; ++blah) { blah };
>
>// just pawns
>for (blah = pawn_start; blah < pawn_end; ++blah) { blah };
>
>// all
>for (blah = piece_start; blah < pawn_end; ++blah) { blah };
>
>and to make this possible, when a capture (or promotion) occurs, some shuffling
>is necessary.
>
>Dave


how about 8 pawns + 16 pieces?  this is what I did in cray blitz. Then a
pawn promotion zeros the pawn pointer and inserts at the end of the
current piece list.  Unmaking does the opposite.



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.