sakurapyon’s blog

sakurapyon’s blog

静止探索の futility pruning 時に best value を更新している

Update bestValue when futility pruning
In qsearch we should update the bestValue as we do
in case of futilityValue < beta, also when pruning
moves with non-positive see.

          futilityValue =  futilityBase
                         + PieceValue[EG][pos.piece_on(to_sq(move))]
                         + (type_of(move) == ENPASSANT ? PawnValueEg : VALUE_ZERO);

          if (futilityValue < beta)
          {
              bestValue = std::max(bestValue, futilityValue);
              continue;
          }

          // Prune moves with negative or equal SEE
          if (   futilityBase < beta
              && depth < DEPTH_ZERO
              && pos.see(move) <= 0)
          {
              bestValue = std::max(bestValue, futilityBase);
              continue;
          }

局面の評価値(futilityBase)にマージンを足した値がβ未満であれば枝刈りするのだが、その際に bestValue を更新している。なぜだろう?

gpsfishには、通常探索時の Futility Pruning でも同様の処理があるが(search.cpp 1238行あたり)、Stockfish 最新版ではその処理は削られている。パッチでは“Don't update bestValue when pruning” “Simply return a fail-low score”と、コメントされている。