PolyGlot 1.4 bug

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

Gian-Carlo Pascutto
Posts: 1260
Joined: Sat Dec 13, 2008 7:00 pm

PolyGlot 1.4 bug

Post by Gian-Carlo Pascutto »

In book_make.cpp:

Code: Select all

  if (false) {
      } else if (my_string_equal(pgn->result,"1-0")) {
         result = +1;
      } else if (my_string_equal(pgn->result,"0-1")) {
         result = -1;     <===============
      }

      while (pgn_next_move(pgn,string,256)) {

         if (ply < MaxPly) {

            move = move_from_san(string,board);

            if (move == MoveNone || !move_is_legal(move,board)) {
               my_fatal("book_insert(): illegal move \"%s\" at line %d, column %d\n",string,pgn->move_line,pgn->move_column);
            }

            pos = find_entry(board,move);

            Book->entry[pos].n++;
            Book->entry[pos].sum += result+1; <========

The rest of the code calculates score as:

Code: Select all

static int entry_score(const entry_t * entry) {

   int score;

   ASSERT(entry!=NULL);

   // score = entry->n; // popularity
   score = entry->sum; // "expectancy"

   if (Uniform) score = 1;

   ASSERT(score>=0);

   return score;
}
I believe the code is confused because the score is always considered for white during building, but some parts of the code don't reflect this. Moves are tossed if they have zero score, although this could mean they simply always win for black.

Move selection is probably broken in the same way. It seems to make no effort to change the meaning depending on who's to move.
Gian-Carlo Pascutto
Posts: 1260
Joined: Sat Dec 13, 2008 7:00 pm

Re: PolyGlot 1.4 bug

Post by Gian-Carlo Pascutto »

Ok, nevermind...there's a sneaky result = -result at the end.