Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: to rotate or not?

Author: Dann Corbit

Date: 22:25:57 04/25/00

Go up one level in this thread


On April 25, 2000 at 23:51:10, Tom Kerrigan wrote:
>On April 25, 2000 at 23:47:48, Tom Kerrigan wrote:
>>On April 25, 2000 at 18:11:59, Dann Corbit wrote:
>>>On April 25, 2000 at 17:24:37, Tom Kerrigan wrote:
>>>>On April 25, 2000 at 17:15:24, Steve Maughan wrote:
>>>>>Tom,
>>>>>
>>>>>>* Non-linked piece lists (I've discovered that linked lists are _bad_!)
>>>>>
>>>>>Hmmm - interesting.  Please do expand!  Surely you're not looping through all of
>>>>>the squares?  Maybe a static array?
>>>>>
>>>>>Regards,
>>>>>
>>>>>Steve Maughan
>>>>
>>>>Right, I keep a static list of the pieces on the board.
>>>>
>>>>Linked lists are bad because they make life hard for the processor (for a number
>>>>of reasons) and the compiler can't do any clever optimization of them.
>>>
>>>Perhaps something along the lines of:
>>>enum piece_type {
>>>    PAWN=0, KNIGHT, BISHOP, ROOK, QUEEN, KING
>>>};
>>>enum piece_color {
>>>    WHITE=0, BLACK
>>>};
>>>typedef struct tag_piece_list {
>>>    unsigned        piece_count;
>>>    unsigned        location[9];
>>
>>Looks similar to what I do, except for this. Why have 9 locations?
>>
>>Here's what I do:
>>
>>typedef struct {
>>  BOOL dead;  // captured
>>  int c;  // color
>>  int t;  // type
>>  int sq;  // square
>>  int bit;  // 1 << type
>>} pl_t;  // piece list type
>>
>>pl_t piece[2][16];
>>int pieces[2];
>>pl_t pawn[2][8];
>>int pawns[2];
>>pl_t *plp[128];  // piece list pointer
>>
>>-Tom
>
>Oh, by the way, I make sure the kings are in position 0 in the lists. That way I
>can find them quickly.

I am curious about the 'dead' flag.  Why not just delete the entry?  Is tagging
it faster?  Are there times you delete and times that you tag?



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.