Author: Robert Hyatt
Date: 08:15:45 05/08/04
Go up one level in this thread
On May 07, 2004 at 21:01:18, Uri Blass wrote:
>On May 07, 2004 at 20:36:03, Dann Corbit wrote:
>
>>On May 07, 2004 at 19:51:42, Uri Blass wrote:
>>
>>>I looked at the code of Crafty to understand what it does when it creates the
>>>opening book(the function BookUp()).
>>>
>>>1)I see that it it is using malloc to allocate memory.
>>>I have no malloc in movei and I use calloc to allocate hash tables.
>>>
>>>I find that Crafty has no calloc but many malloc and my question is if there is
>>>a reason for that.
>>
>>To be totally portable, the only thing that calloc() should be used on is an
>>array of unsigned character (though signed char is probably safe too).
>>
>>For instance, you have no guarantee that pointers will be NULL or that float or
>>double will be zero or int values will contain zero.
>>
>>>2)I understand that crafty first translate pgn to book positions but I do not
>>>see moves in the following structs
>>>
>>>typedef struct {
>>> BITBOARD position;
>>> unsigned int status_played;
>>> float learn;
>>> int CAP_score;
>>>} BOOK_POSITION;
>>>
>>>typedef struct {
>>> unsigned char position[8];
>>> unsigned char status;
>>> unsigned char percent_play;
>>>} BB_POSITION;
>>>
>>>
>>>My question is where does Crafty save the moves.
>>
><snipped>
>>/*
>> ************************************************************
>> * *
>> * first cycle through the root move list, make each *
>> * move, and see if the resulting hash key is in the book *
>> * database. *
>> * *
>> ************************************************************
>> */
>
>
>Yes but the code later does not answer my question.
>Does crafty check the root position to see that it is in the database before
>making every move to see if the resulting position is in the database?
Yes, but it would not matter if it didn't, it would just probe the book when
there could not possibly be signature matches...
>
>I think that both positions should be in the database if the book does not
>contain moves.
>
They _must_ be there since a book signature is 16 bits from position before the
move and 48 from the position after the move. If the parent position is not in
the book moves, there can be no book signature that would match...
><snipped>
>>>3)If I understand correctly Crafty first remember the book in a big array and
>>>only later sort the big array by BookSort and later copy it to a file.
>>
>>That is a "once in a while" operation that only happens when you make a new
>>book.
>
>Yes but this is what I am interested in because in order to use a book you first
>need to make a book.
>
>My question is what is the need for the least lexically position key
>when you make a new book.
>
Sorts them into the ending file so that positions with the same parent are
adjacent. This avoids seeking all over the file to find position matches.
>Uri
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.