#include <iostream>
#include <iomanip>
#include <sstream>
+#include <algorithm>
#include "bitcount.h"
#include "evaluate.h"
//
// Values modified by Joona Kiiski
const Score WeightsInternal[] = {
- S(248, 271), S(252, 259), S(46, 0), S(247, 0), S(259, 0)
+ S(252, 344), S(252, 259), S(46, 0), S(247, 0), S(259, 0)
};
// MobilityBonus[PieceType][attacked] contains mobility bonuses for middle and
if (bonus && bit_is_set(ei.attackedBy[Us][PAWN], s))
{
if ( pos.pieces(KNIGHT, Them) == EmptyBoardBB
- && (SquaresByColorBB[square_color(s)] & pos.pieces(BISHOP, Them)) == EmptyBoardBB)
+ && (SquaresByColorBB[color_of(s)] & pos.pieces(BISHOP, Them)) == EmptyBoardBB)
bonus += bonus + bonus / 2;
else
bonus += bonus / 2;
// the number and types of the enemy's attacking pieces, the number of
// attacked and undefended squares around our king, the square of the
// king, and the quality of the pawn shelter.
- attackUnits = Min(25, (ei.kingAttackersCount[Them] * ei.kingAttackersWeight[Them]) / 2)
+ attackUnits = std::min(25, (ei.kingAttackersCount[Them] * ei.kingAttackersWeight[Them]) / 2)
+ 3 * (ei.kingAdjacentZoneAttacksCount[Them] + count_1s<Max15>(undefended))
+ InitKingDanger[relative_square(Us, ksq)]
- mg_value(ei.pi->king_shelter<Us>(pos, ksq)) / 32;
attackUnits += KnightCheckBonus * count_1s<Max15>(b);
// To index KingDangerTable[] attackUnits must be in [0, 99] range
- attackUnits = Min(99, Max(0, attackUnits));
+ attackUnits = std::min(99, std::max(0, attackUnits));
// Finally, extract the king danger score from the KingDangerTable[]
// array and subtract the score from evaluation. Set also margins[]
continue;
pliesToGo = 2 * movesToGo - int(c == pos.side_to_move());
- pliesToQueen[c] = Min(pliesToQueen[c], pliesToGo);
+ pliesToQueen[c] = std::min(pliesToQueen[c], pliesToGo);
}
}
while (b2) // This while-loop could be replaced with LSB/MSB (depending on color)
{
d = square_distance(blockSq, pop_1st_bit(&b2)) - 2;
- movesToGo = Min(movesToGo, d);
+ movesToGo = std::min(movesToGo, d);
}
}
while (b2) // This while-loop could be replaced with LSB/MSB (depending on color)
{
d = square_distance(blockSq, pop_1st_bit(&b2)) - 2;
- movesToGo = Min(movesToGo, d);
+ movesToGo = std::min(movesToGo, d);
}
// If obstacle can be destroyed with an immediate pawn exchange / sacrifice,
// Plies needed for the king to capture all the blocking pawns
d = square_distance(pos.king_square(loserSide), blockSq);
- minKingDist = Min(minKingDist, d);
+ minKingDist = std::min(minKingDist, d);
kingptg = (minKingDist + blockersCount) * 2;
}
t[i] = Value(int(0.4 * i * i));
if (i > 0)
- t[i] = Min(t[i], t[i - 1] + MaxSlope);
+ t[i] = std::min(t[i], t[i - 1] + MaxSlope);
- t[i] = Min(t[i], Peak);
+ t[i] = std::min(t[i], Peak);
}
// Then apply the weights and get the final KingDangerTable[] array