Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Incremental movegeneration

Author: Frank Schneider

Date: 13:27:20 05/07/98

Go up one level in this thread


On May 07, 1998 at 15:51:16, Bas Hamstra wrote:

>Do you think it would be possible to generate moves incrementally? Most
>of the legal moves remain the same after a move is made, it seems. I
>think it might be possible to generate only moves for the pieces that
>are "affected" by the prior move.

Yes, Gromit uses this idea. About 30-40% of the moves have to be
generated, the other moves don't change.

>
>If I'm not mistaken KnightCap does this (or was in another program?). It
>has a board representation in which each square is a 32 bit number, each
>bit representing the (uniquely identified) piece by which that square is
>attacked. There can be no more pieces on the board than 32.
Gromit uses a similar board representation, which is expensive but
informative.

>
>Suppose a move a2-a3 is made. Adjust the board (="attackmap") for the
>new squares a3 attacks and delete the a2-attacks. If a2 OR a3 is
>attacked by a piece (of both colors) only the moves for those pieces are
>to be regenerated and the board has to be updated again, for just those
>pieces.
That is right, but you also have to handle pawns since they move to
squares
they don't attack. Other exceptions that affect more than two squares
are
en-passant and castling.
When a piece is affected by a move I set a flag that the movelist needs
updating
and only generate the moves when a move is needed.

>Would that work you think?
>
>Problem: what to do with unmake? Compute it all "back" seems exspensive.
>Or no unmake at all and fetch the previous board? Wouldnt that be
>expensive too on a PC (bandwitdh and all)?
Yes, fetching the previous board is quite expensive (for Gromit) :-(.
The problem is not the movegeneration but the board representation.
On the other hand, 'chessknowledge-code' is easier to program and faster
using this computationally expensive representation, but I think
bitboards
are the better alternative.

>
>Could someone please react on this thoughts?



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.