Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: piece list possibilities

Author: Robert Hyatt

Date: 16:55:12 07/07/98

Go up one level in this thread


On July 07, 1998 at 19:23:39, Tom Kerrigan wrote:

>I want to write a very small chess program and I'm considering possible methods
>to store a list of pieces.
>Practically every time a chess program loops through a piece list, it's only
>concerned with pieces or pawns of a particular color. Thus, I had this in mind:
>
>int piece_list[32];
>/* piece_list 0 to 7: white pieces
>   piece_list 8 to 15: white pawns
>   piece_list 16 to 23: black pieces
>   piece_list 24 to 31: black pawns
>*/
>int white_pieces;
>int white_pawns;
>int black_pieces;
>int black_pawns;
>
>I think this is reasonable until a piece needs to be removed. Then the computer
>needs to figure out which list the piece belongs to, and this sounds
>time-consuming.
>Any comments or suggestions?
>
>Cheers,
>Tom


we used this in Cray Blitz.  Since you have a board[x] array, use a
pboard[x] array... where if you access pboard[x] it gives you an index
into the piece list rather than the piece on that square.  Worked well
for us, although we did it for vector-processing reasons...



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.