Crafty question

Discussion of chess software programming and technical issues.

Moderator: Ras

Cardoso
Posts: 363
Joined: Thu Mar 16, 2006 7:39 pm
Location: Portugal
Full name: Alvaro Cardoso

Crafty question

Post by Cardoso »

Hi,
looking at crafty source at the Output() function, I noted that on a fail high crafty makes a 2 move pv, shouldn't it be just one move?

many thanks,
Alvaro

Code: Select all

    if (value < bound) {
      UnmakeMove(tree, 1, tree->pv[1].path[1], root_wtm);
      DisplayPV(tree, 6, wtm, end_time - start_time, value, &tree->pv[1]);
      MakeMove(tree, 1, tree->pv[1].path[1], root_wtm);
    } else {
      if (tree->curmv[1] != tree->pv[1].path[1]) {
        tree->pv[1].path[1] = tree->curmv[1];
        tree->pv[1].pathl = 2; <--------------- should not be 1 ? ------------
        tree->pv[1].pathh = 0;
        tree->pv[1].pathd = iteration_depth;
      }
    }
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Crafty question

Post by bob »

Cardoso wrote:Hi,
looking at crafty source at the Output() function, I noted that on a fail high crafty makes a 2 move pv, shouldn't it be just one move?

many thanks,
Alvaro

Code: Select all

    if (value < bound) {
      UnmakeMove(tree, 1, tree->pv[1].path[1], root_wtm);
      DisplayPV(tree, 6, wtm, end_time - start_time, value, &tree->pv[1]);
      MakeMove(tree, 1, tree->pv[1].path[1], root_wtm);
    } else {
      if (tree->curmv[1] != tree->pv[1].path[1]) {
        tree->pv[1].path[1] = tree->curmv[1];
        tree->pv[1].pathl = 2; <--------------- should not be 1 ? ------------
        tree->pv[1].pathh = 0;
        tree->pv[1].pathd = iteration_depth;
      }
    }
Loops to output this look as follows:

for (i=1; i< pv[1].pathl; i++) { something }

So "2" really means "1". :)

This works because the last "move" in the PV does not exist. If I search 6 moves in a row, and then call Evaluate() at ply=7, it will set the pv length to 7, but there are only 6 moves in the thing.