Computer Chess Club Archives


Search

Terms

Messages

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

Author: Robert Hyatt

Date: 05:45:49 04/04/00

Go up one level in this thread


On April 04, 2000 at 07:40:38, Jan Pernicka wrote:

>On April 03, 2000 at 08:42:21, Robert Hyatt wrote:
>
>>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.
>>
>
>>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).
>
>
> Thank you,
>
>   but I have yet several questions:
>
>  When do you throw away the book from memory? (not found any moves
>      for 3 positions there ?)


I don't read the book into memory. I read 'chunks' as needed, and I let the
operating system cache stuff to make it fast.  I give up on the book after
three successive moves don't find a book move...



>
>  How big hash table should be used for book?
>     (there can be conflict between "normal" hash table and "openning"
>       hash table(in their sizes) - they can be present in memory at the same
>      time - but only if answer to my previous question is not "1" ... )
>
>  Thanks,
>

I don't use a hash table.  I 'pack' the book positions together into one file,
and then read pieces of that as needed...  this way the file is not a 'sparse'
file with lots of empty space in it...





>     Jan
>
>PS: In fact, your method finds a move in time proportional to number of moves
>     generated from that position, which could be said to be constant... :)



This page took 0.01 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.