Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Move structure

Author: Michel Langeveld

Date: 03:41:34 02/21/04

Go up one level in this thread


On February 21, 2004 at 04:09:22, Mathieu Pagé wrote:

>Hi,
>
>This is my move structure:
>
>class CCoup{
>  char tcCoup;	 // type of move castling promotion (the piece)
>  unsigned char cPiecePrisePieceJoue; // type of the piece moved and on the
>                                      // piece taken if any.
>
>  int iFrom;			 // self explaning
>  int iTo;				 // ditto
>
>...
>};
>
>It is 10 bytes long. is it common to have a move struct that "big" ?
>
>from and to could be compress to one byte each, but i Think (i'm not sure) it
>would be less efficient since I often have to use them as a table index and a
>table index is always (on my target architecture) 4 bytes.
>
>Am I right ? What do you think of it ?
>
>Mathieu P.

What works the best depends ofrourse on the program and what
it uses the movestructure all for.

The taken piece is not really a property of a move but of the position.

I changed Nullmover recently that it uses a struct of 4 bytes instead of 5 bytes
(with captured piece).
-char fromfield
-char tofield
-char promotionpiece
-char movekind.

In some programs the fromfield and tofield can be only 0..63 then you can
optimize it even more futher. Then this can be stored in 6 bits. The
promotionpiece is always [rook, queen, bishop, knight] = 2 bits. It is
theoritical possible to work without a movekind or a movekind of 2 bit
so 6+6+2+2 = 16bits = short

I keep the taken piece now not in a move struct itself but on a historystack
(with other incremental information that takes too long to calculate in
restoremove.

Movestruct implementation influences logic for:
- sorting moves
- killers
- history heuristic
- putting moves into hashtables

Changing movestruct can be a big change in some programs and a small change in
others. It took me 3 evenings to change this in Nullmover and gave me a 10%-20%
performance boost and I could trow away so difficult to read code.

I am now busy with adding piecelists for almost a week. It seems to be I can put
a stamp 'fully-tested-and-no-bugs' on it today.

To have piecelists influences:
- building attacktables
- how quicky you can probe namilov tables
- evaluation

Michel



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.