Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: a question about some crafty book code

Author: Uri Blass

Date: 14:27:48 05/09/04

Go up one level in this thread


On May 09, 2004 at 15:06:30, Uri Blass wrote:

>I see that crafty is using the following commands:
>
>if (buffered >= SORT_BLOCK) {
>                  BookSort(bbuffer,buffered,++files)
>
>If I understand correctly the book of crafty is not one file but some files,
>when every file is not more that SORT_BLOCK positions.
>
>I wonder what is the reason for it.
>I think that it is more simple to call booksort only one time, after I read all
>the book positions into an array.
>
>The only problem can be if the book is too big so there is not enough memory in
>RAM, but I think that it is not a practical problem with the hardware that you
>have.
>
>Do you do it in order to support users with inferior hardware or to support
>bigger books (that you practically not need for better results), or is there
>another reason for it?
>
>Uri

Another question that I have is if I can use the bookupcompare function from
Crafty(see the bottom of this post).

I do not like to copy and paste code from other programs but I do not see a
different way to compare between positions and the only difference may be that I
may have different structure relative to the BB_POSITION structure.

I do not understand the
"#if defined(NT_i386)" that I do not post here and I guess that this is for
different hardware or different system like linux and I do not like to care
about running on different system.

int BookUpCompare(const void *pos1, const void *pos2) {
  static BITBOARD p1, p2;
  memcpy((char*)&p1,((BB_POSITION *)pos1)->position,8);
  memcpy((char*)&p2,((BB_POSITION *)pos2)->position,8);
  if (p1 < p2) return(-1);
  if (p1 > p2) return(+1);
  return(0);
}

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.