Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: condition in Crafty that never happens when it creates book

Author: Robert Hyatt

Date: 19:54:34 11/20/04

Go up one level in this thread


On November 19, 2004 at 02:06:21, Uri Blass wrote:

>I decided to use modified crafty's code only for the task of reading pgn files(I
>understood from Bob that there is no problem with it and I plan to make the
>relevant code public) but it seems that Crafty has in it's code irrelevant
>lines.

Seems to be something from old changes.  You are correct, the if test is not
needed and the discarded++ is never hit...




>
>It seems to me that ply<=max_ply happens always.
>
>Here is the relevant code from book.c of Crafty with some comments that I added.
>The code is part of the BookUp function of Crafty.
>
>Am I right that discarded++ never happens and it is better if Crafty get rid of
>this variable for doing the code more simple to understand?
>
>
>
>if (ply < max_ply)
>              move=ReadNextMove(tree,buffer,2,wtm);
>            else move=0;
>            if (move) {
>/*ply<maxply because of the last if */
>
>
>              ply++;
>/*ply<=max_ply now*/
>              max_search_depth=Max(max_search_depth,ply);
>              total_moves++;
>              common=HashKey & mask_16;
>              MakeMove(tree,2,move,wtm);
>              tree->position[2]=tree->position[3];
>/*nothing was changed and we still have ply<=max_ply so I do not understand the
>reason for the following if and discarded++ seems to never happen*/
>
>              if (ply <= max_ply) {
>                temp_hash_key=HashKey ^ wtm_random[wtm];
>                temp_hash_key=(temp_hash_key & ~mask_16) | common;
>                memcpy(bbuffer[buffered].position,(char*)&temp_hash_key,8);
>                if (result == 0) mask_word|=0100;
>                else if (result&2) mask_word|=0200;
>                else if (result&1) mask_word|=040;
>                bbuffer[buffered].status=mask_word;
>                bbuffer[buffered++].percent_play=pgn_suggested_percent+(wtm<<7);
>                if (buffered >= SORT_BLOCK) {
>                  BookSort(bbuffer,buffered,++files);
>                  buffered=0;
>                  strcpy(schar,"S");
>                }
>              }
>              else {
>                discarded++;
>              }



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.