/*
Stockfish, a UCI chess playing engine derived from Glaurung 2.1
Copyright (C) 2004-2008 Tord Romstad (Glaurung author)
- Copyright (C) 2008-2012 Marco Costalba, Joona Kiiski, Tord Romstad
+ Copyright (C) 2008-2013 Marco Costalba, Joona Kiiski, Tord Romstad
Stockfish is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
static PolyglotBook book; // Defined static to initialize the PRNG only once
RootColor = RootPos.side_to_move();
- TimeMgr.init(Limits, RootPos.startpos_ply_counter(), RootColor);
+ TimeMgr.init(Limits, RootPos.game_ply(), RootColor);
if (RootMoves.empty())
{
newDepth = depth - ONE_PLY + ext;
// Step 13. Futility pruning (is omitted in PV nodes)
- if ( !PvNode
- && !captureOrPromotion
+ if ( !captureOrPromotion
&& !inCheck
&& !dangerous
&& move != ttMove
- && (bestValue > VALUE_MATED_IN_MAX_PLY || ( bestValue == -VALUE_INFINITE
- && alpha > VALUE_MATED_IN_MAX_PLY)))
+ && alpha > VALUE_MATED_IN_MAX_PLY)
{
// Move count based pruning
- if ( depth < 16 * ONE_PLY
+ if ( !PvNode
+ && depth < 16 * ONE_PLY
&& moveCount >= FutilityMoveCounts[depth]
&& (!threatMove || !refutes(pos, move, threatMove)))
{
futilityValue = ss->staticEval + ss->evalMargin + futility_margin(predictedDepth, moveCount)
+ Gain[pos.piece_moved(move)][to_sq(move)];
- if (futilityValue < beta)
+ if (!PvNode && futilityValue < beta)
{
if (SpNode)
sp->mutex.lock();