LimitsType Limits;
std::vector<RootMove> RootMoves;
Position RootPosition;
+ Color RootColor;
Time::point SearchTime;
StateStackPtr SetupStates;
}
int BestMoveChanges;
int SkillLevel;
bool SkillLevelEnabled, Chess960;
- Value DrawValue[2];
+ Value DrawValue[COLOR_NB];
History H;
template <NodeType NT>
// Init futility move count array
for (d = 0; d < 32; d++)
- FutilityMoveCounts[d] = int(3.001 + 0.25 * pow(d, 2.0));
+ FutilityMoveCounts[d] = int(3.001 + 0.25 * pow(double(d), 2.0));
}
Position& pos = RootPosition;
Chess960 = pos.is_chess960();
- Eval::RootColor = pos.side_to_move();
+ RootColor = pos.side_to_move();
TimeMgr.init(Limits, pos.startpos_ply_counter(), pos.side_to_move());
TT.new_search();
H.clear();
{
int cf = Options["Contempt Factor"] * PawnValueMg / 100; // In centipawns
cf = cf * MaterialTable::game_phase(pos) / PHASE_MIDGAME; // Scale down with phase
- DrawValue[ Eval::RootColor] = VALUE_DRAW - Value(cf);
- DrawValue[~Eval::RootColor] = VALUE_DRAW + Value(cf);
+ DrawValue[ RootColor] = VALUE_DRAW - Value(cf);
+ DrawValue[~RootColor] = VALUE_DRAW + Value(cf);
}
else
DrawValue[WHITE] = DrawValue[BLACK] = VALUE_DRAW;
&& type_of(pos.piece_on(to_sq(move))) != PAWN
&& type_of(move) == NORMAL
&& ( pos.non_pawn_material(WHITE) + pos.non_pawn_material(BLACK)
- - PieceValue[Mg][pos.piece_on(to_sq(move))] == VALUE_ZERO));
+ - PieceValue[MG][pos.piece_on(to_sq(move))] == VALUE_ZERO));
// Step 12. Extend checks and, in PV nodes, also dangerous moves
if (PvNode && dangerous)
// If we are in a singular extension search then return a fail low score.
// A split node has at least one move, the one tried before to be splitted.
if (!moveCount)
- return excludedMove ? alpha : inCheck ? mated_in(ss->ply) : VALUE_DRAW;
+ return excludedMove ? alpha
+ : inCheck ? mated_in(ss->ply) : DrawValue[pos.side_to_move()];
// If we have pruned all the moves without searching return a fail-low score
if (bestValue == -VALUE_INFINITE)
&& !pos.is_passed_pawn_push(move))
{
futilityValue = futilityBase
- + PieceValue[Eg][pos.piece_on(to_sq(move))]
+ + PieceValue[EG][pos.piece_on(to_sq(move))]
+ (type_of(move) == ENPASSANT ? PawnValueEg : VALUE_ZERO);
if (futilityValue < beta)
while (b)
{
// Note that here we generate illegal "double move"!
- if (futilityBase + PieceValue[Eg][pos.piece_on(pop_lsb(&b))] >= beta)
+ if (futilityBase + PieceValue[EG][pos.piece_on(pop_lsb(&b))] >= beta)
return true;
}
// Case 2: If the threatened piece has value less than or equal to the
// value of the threatening piece, don't prune moves which defend it.
if ( pos.is_capture(threat)
- && ( PieceValue[Mg][pos.piece_on(tfrom)] >= PieceValue[Mg][pos.piece_on(tto)]
+ && ( PieceValue[MG][pos.piece_on(tfrom)] >= PieceValue[MG][pos.piece_on(tto)]
|| type_of(pos.piece_on(tfrom)) == KING)
&& pos.move_attacks_square(m, tto))
return true;