Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: C or C++ for Chess Programming?

Author: Dann Corbit

Date: 17:13:23 08/18/00

Go up one level in this thread


On August 18, 2000 at 05:07:09, Dan Newman wrote:
[snip]
>OTOH, I have occasionally considered attempting a full blown OPP chess
>program complete with pools of chess pieces with overloaded new so that
>(for instance) on pawn promotion I could delete the pawn and new a queen...

Dumb as a box o' rocks observation:
Since the absolute "max" of posible chessmen is known, why hot just preallocate
a "box" of chess pieces with enough spares for either side.  Captured
pieces/pawns go into the box and promoted pieces are pulled from it.

At the start of a game, it contains:

White rooks: 8
White knights: 8
White bishops: 8
White queens: 8
White pawns: 0
No White king slot
Black rooks: 8
Black knights: 8
Black bishops: 8
Black queens: 8
Black pawns: 0
No Black king slot

If you wanted to carry the metaphor further, you could have all the starting
chess men in the box to start with and construct the board by pulling pieces and
pawns out of the box.

Each piece could have a bit that means in use/in box to use for error checking.

Sounds like bizarre overkill, perhaps.  But if your evaluation removes hundreds
of pieces or promotes hundreds of pieces during a search, it might be useful to
do it that way.



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.