Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: questions about Crafty's book

Author: Uri Blass

Date: 18:01:18 05/07/04

Go up one level in this thread


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?

I think that both positions should be in the database if the book does not
contain moves.

<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.

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.