move count based pruning

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

jdart
Posts: 4367
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: move count based pruning - new results.

Post by jdart »

But the funny part is that the way I prune is about 2x as aggressive as your counter-based method, since the trees are about 1/2 the size of those your LMP idea searches.
FYI Stockfish does both value based futility + move count pruning (this is from 1.71):

Code: Select all

      // Step 12. Futility pruning
      if (   !isCheck
          && !dangerous
          && !captureOrPromotion
          && !move_is_castle(move))
      {
          // Move count based pruning
          if (   moveCount >= futility_move_count(sp->depth)
              && ok_to_prune(pos, move, ss[sp->ply].threatMove)
              && sp->bestValue > value_mated_in(PLY_MAX))
          {
              lock_grab(&(sp->lock));
              continue;
          }

          // Value based pruning
          Depth predictedDepth = newDepth - nonpv_reduction(sp->depth, moveCount);
          futilityValueScaled =  ss[sp->ply].eval + futility_margin(predictedDepth, moveCount)
                                     + H.gain(pos.piece_on(move_from(move)), move_to(move)) + 45;

          if &#40;futilityValueScaled < sp->beta&#41;
          &#123;
              lock_grab&#40;&&#40;sp->lock&#41;);

              if &#40;futilityValueScaled > sp->bestValue&#41;
                  sp->bestValue = futilityValueScaled;
              continue;
          &#125;
      &#125;
Note also there is no explicit depth limit above which pruning is not done - the thresholds just get higher.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: move count based pruning - new results.

Post by bob »

jdart wrote:
But the funny part is that the way I prune is about 2x as aggressive as your counter-based method, since the trees are about 1/2 the size of those your LMP idea searches.
FYI Stockfish does both value based futility + move count pruning (this is from 1.71):

Code: Select all

      // Step 12. Futility pruning
      if (   !isCheck
          && !dangerous
          && !captureOrPromotion
          && !move_is_castle&#40;move&#41;)
      &#123;
          // Move count based pruning
          if (   moveCount >= futility_move_count&#40;sp->depth&#41;
              && ok_to_prune&#40;pos, move, ss&#91;sp->ply&#93;.threatMove&#41;
              && sp->bestValue > value_mated_in&#40;PLY_MAX&#41;)
          &#123;
              lock_grab&#40;&&#40;sp->lock&#41;);
              continue;
          &#125;

          // Value based pruning
          Depth predictedDepth = newDepth - nonpv_reduction&#40;sp->depth, moveCount&#41;;
          futilityValueScaled =  ss&#91;sp->ply&#93;.eval + futility_margin&#40;predictedDepth, moveCount&#41;
                                     + H.gain&#40;pos.piece_on&#40;move_from&#40;move&#41;), move_to&#40;move&#41;) + 45;

          if &#40;futilityValueScaled < sp->beta&#41;
          &#123;
              lock_grab&#40;&&#40;sp->lock&#41;);

              if &#40;futilityValueScaled > sp->bestValue&#41;
                  sp->bestValue = futilityValueScaled;
              continue;
          &#125;
      &#125;
Note also there is no explicit depth limit above which pruning is not done - the thresholds just get higher.
Am I missing something? Don't _both_ of those still use a value, rather than just a raw move number within the list, to make the decision???
jdart
Posts: 4367
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: move count based pruning - new results.

Post by jdart »

Code: Select all

if (   moveCount >= futility_move_count&#40;sp->depth&#41;
              && ok_to_prune&#40;pos, move, ss&#91;sp->ply&#93;.threatMove&#41;
              && sp->bestValue > value_mated_in&#40;PLY_MAX&#41;) 
The first line is the move count test (futility_move_count gets the count value to compare). The second line tests for some conditions like not matching the threat move returned from null pruning. But it does not check the score. The 3rd line just avoids moves that have mate scores.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: move count based pruning - new results.

Post by bob »

jdart wrote:

Code: Select all

if (   moveCount >= futility_move_count&#40;sp->depth&#41;
              && ok_to_prune&#40;pos, move, ss&#91;sp->ply&#93;.threatMove&#41;
              && sp->bestValue > value_mated_in&#40;PLY_MAX&#41;) 
The first line is the move count test (futility_move_count gets the count value to compare). The second line tests for some conditions like not matching the threat move returned from null pruning. But it does not check the score. The 3rd line just avoids moves that have mate scores.
Looks like you are correct. I had thought those were tied together when I glanced at it the first time when you posted it. There are a couple of restrictions, such as the !dangerous test which covers things from checks, to escaping checks, to pushing passed pawns to 7th, etc... so there are some restrictions as opposed to just dumping moves beyond N...