Computer Chess Club Archives


Search

Terms

Messages

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

Author: Stefano Gemma

Date: 23:10:35 08/21/00

Go up one level in this thread


On August 21, 2000 at 20:22:08, Larry Griffiths wrote:

[...]
>I keep a list of black pieces and a list of white pieces.  When a ply has to
>generate moves for the pieces, it loops thru the piece list.  I guess this was
>the quickest way to generate moves without scanning thru the entire boards
>squares looking for black pieces.

I do the same in Drago and Raffaela. The board contains pointers to pieces while
the array of pieces contains pointers to board. The programs are in assembly. I
have recently implemented a C++ version, just to test faster the new genethical
algorithm i wish to use. The move generation seems to be up to ten time faster
in assembly (but ten time harder to debug) than C++.

>for(int i=0;i<blackpiecelist->Count;i++)
>   {
>   if(!blackpiecelist[i]->State&psCAPTURED)
>      {  // The piece is not captured (or promoted)
>      blackpiecelist[i]->GenerateCaptures;
>      }
>   }
>When a piece is captured or a pawn is promoted, then its state is set to
>CAPTURED.  (probably should have used MIA or something instead of CAPTURED :)
[...]

I just put NULL in the piece pointer to chessboard, to set captured state. When
i store a move, i'll store even the chessboard pointer to destination square. I
use this value to restore original captured piece position (should be checked
for en-passant) when i unmake that move.

Ciao!!!

PS:to see the assembly sources of my move generator, you can go to
www.linformatica.com (section chess).





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.