Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Pre-calculated move generation

Author: Bruce Moreland

Date: 09:49:52 06/26/00

Go up one level in this thread


On June 26, 2000 at 12:31:22, ujecrh wrote:

>I wonder if it has already been tried or if it is not useful/feasible at all.
>
>The idea is that, excepting special moves like castle or en-passant we could
>easilly generate all possible moves for all possible piece/square at the very
>start of the engine. It would fill some arrays (like
>rook_moves[square][directions][moves/or destination square])with a total of
>about 4000 entries.
>
>Having not to generate moves during the search itself might save some time and
>even a slow move generator wold not be a problem as it would be called only at
>initialization of the engine.
>
>Is that completely wrong ?
>
>Ujecrh

GnuChess does that, and probably several other programs including mine.

Mine uses an array of structs, each of which contains from/to information,
positional evaluation deltas, hash key deltas, etc.  When a piece moves, a
pointer into this array is updated (the new value is also in the array), and
when moves are generated for that piece I just go to the appropriate place in
the table and start going.  Each table element contains a pointer to the element
to go to if a square is blocked.  If you aren't blocked, you go to the next
table element, and there's a flag that tells you if you are at the last one.

The advantages are that there's little thought going on during move generation,
and you can precompute some stuff that might require some hefty calculation at
run-time.

The disadvantage is that you do a lot of memory accesses, and that the technique
uses a lot of memory (which is less a problem now than it used to be).

bruce




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.