FORCE_INLINE bool is_dangerous(const Position& pos, Move m, bool captureOrPromotion) {
// Test for a pawn pushed to 7th or a passed pawn move
- if (type_of(pos.piece_on(from_sq(m))) == PAWN)
+ if (type_of(pos.piece_moved(m)) == PAWN)
{
Color c = pos.side_to_move();
if ( relative_rank(c, to_sq(m)) == RANK_7
stop = true;
// Stop search early if one move seems to be much better than others
- if ( depth >= 10
+ if ( depth >= 12
&& !stop
- && ( bestMoveNeverChanged
+ && ( (bestMoveNeverChanged && pos.captured_piece_type())
|| elapsed_time() > (TimeMgr.available_time() * 40) / 100))
{
Value rBeta = bestValue - EasyMoveMargin;
(ss+1)->excludedMove = RootMoves[0].pv[0];
(ss+1)->skipNullMove = true;
- Value v = search<NonPV>(pos, ss+1, rBeta - 1, rBeta, (depth * ONE_PLY) / 2);
+ Value v = search<NonPV>(pos, ss+1, rBeta - 1, rBeta, (depth - 3) * ONE_PLY);
(ss+1)->skipNullMove = false;
(ss+1)->excludedMove = MOVE_NONE;
if ( (move = (ss-1)->currentMove) != MOVE_NULL
&& (ss-1)->eval != VALUE_NONE
&& ss->eval != VALUE_NONE
- && pos.captured_piece_type() == NO_PIECE_TYPE
+ && !pos.captured_piece_type()
&& !is_special(move))
{
Square to = to_sq(move);
// but fixing this made program slightly weaker.
Depth predictedDepth = newDepth - reduction<PvNode>(depth, moveCount);
futilityValue = futilityBase + futility_margin(predictedDepth, moveCount)
- + H.gain(pos.piece_on(from_sq(move)), to_sq(move));
+ + H.gain(pos.piece_moved(move), to_sq(move));
if (futilityValue < beta)
{
// Increase history value of the cut-off move
Value bonus = Value(int(depth) * int(depth));
- H.add(pos.piece_on(from_sq(move)), to_sq(move), bonus);
+ H.add(pos.piece_moved(move), to_sq(move), bonus);
// Decrease history of all the other played non-capture moves
for (int i = 0; i < playedMoveCount - 1; i++)
{
Move m = movesSearched[i];
- H.add(pos.piece_on(from_sq(m)), to_sq(m), -bonus);
+ H.add(pos.piece_moved(m), to_sq(m), -bonus);
}
}
}
from = from_sq(move);
to = to_sq(move);
- them = flip(pos.side_to_move());
+ them = ~pos.side_to_move();
ksq = pos.king_square(them);
kingAtt = pos.attacks_from<KING>(ksq);
pc = pos.piece_on(from);
&& !Signals.failedLowAtRoot
&& e > TimeMgr.available_time();
- bool noMoreTime = e > TimeMgr.maximum_time() - TimerResolution
+ bool noMoreTime = e > TimeMgr.maximum_time() - 2 * TimerResolution
|| stillAtFirstMove;
if ( (Limits.use_time_management() && noMoreTime)