Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: How to organize Opening book in memory?

Author: Robert Hyatt

Date: 05:42:21 04/03/00

Go up one level in this thread


On April 03, 2000 at 05:57:51, Jan Pernicka wrote:

>  Hi,
>I would like to know how to make opening book(OB) "run" in memory (MEM)
> as efficient as possible.
>I think OB should have (in MEM) these properties:
>  1) Allow transpositions
>  2) Retrieve "wanted" position" in constant time or in the worst case
>     in time proportional to moves played in the game up to "now"
>  3) Have reasonable size (as small as possible...)
>
>I think several was of implementing it are possible:
>    1) store "partial" game tree from starting position - IE store
>       only several "best" moves in each pos.
>    2) use "modified" hash table - to allow multiple "best" moves...
>    3) "others"
>
>
>  But - what's common practice 1) or 2) or 3) ?
>
>  Thank you in advance
>
>      Jan Pernicka
>
>PS: Up to now I use that one from 1) and have OP stored in ASCII text
>      on HDD.
>PS2: It could be also possible to have "Kingside Opening Book" and so on
>      to load the desired (and thus smaller) book during play... (?)


Neither.

Store hash keys _after_ each move... then you don't store 'moves' in the book
at all.  You store hash keys that are produced by making specific moves.  To
find a book move, generate all legal moves, make each one, and probe the book
after making the move.  If you get a hit, this is a book position.  Repeat for
all legal moves to get the set of known book moves...

Doing it in constant time is also easy. See crafty's source (book.c).



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.