&& sf == SCALE_FACTOR_NORMAL)
{
// Only the two bishops ?
- if ( pos.non_pawn_material(WHITE) == BishopValueMidgame
- && pos.non_pawn_material(BLACK) == BishopValueMidgame)
+ if ( pos.non_pawn_material(WHITE) == BishopValueMg
+ && pos.non_pawn_material(BLACK) == BishopValueMg)
{
// Check for KBP vs KB with only a single pawn that is almost
// certainly a draw or at least two pawns.
// Init king safety tables only if we are going to use them
if ( pos.piece_count(Us, QUEEN)
- && pos.non_pawn_material(Us) >= QueenValueMidgame + RookValueMidgame)
+ && pos.non_pawn_material(Us) >= QueenValueMg + RookValueMg)
{
ei.kingRing[Them] = (b | (Us == WHITE ? b >> 8 : b << 8));
b &= ei.attackedBy[Us][PAWN];
assert(b);
if (!more_than_one(b) && (b & pos.pieces(Them)))
- score += ThreatBonus[Piece][type_of(pos.piece_on(first_1(b)))];
+ score += ThreatBonus[Piece][type_of(pos.piece_on(lsb(b)))];
}
// Decrease score if we are attacked by an enemy pawn. Remaining part
return SCORE_ZERO;
do {
- Square s = pop_1st_bit(&b);
+ Square s = pop_lsb(&b);
assert(pos.pawn_is_passed(Us, s));
// value if the other side has a rook or queen.
if (file_of(s) == FILE_A || file_of(s) == FILE_H)
{
- if (pos.non_pawn_material(Them) <= KnightValueMidgame)
+ if (pos.non_pawn_material(Them) <= KnightValueMg)
ebonus += ebonus / 4;
else if (pos.pieces(Them, ROOK, QUEEN))
ebonus -= ebonus / 4;
while (b)
{
- s = pop_1st_bit(&b);
- queeningSquare = relative_square(c, make_square(file_of(s), RANK_8));
+ s = pop_lsb(&b);
+ queeningSquare = relative_square(c, file_of(s) | RANK_8);
queeningPath = forward_bb(c, s);
// Compute plies to queening and check direct advancement
while (b)
{
- s = pop_1st_bit(&b);
+ s = pop_lsb(&b);
// Compute plies from queening
- queeningSquare = relative_square(loserSide, make_square(file_of(s), RANK_8));
+ queeningSquare = relative_square(loserSide, file_of(s) | RANK_8);
movesToGo = rank_distance(s, queeningSquare) - int(relative_rank(loserSide, s) == RANK_2);
pliesToGo = 2 * movesToGo - int(loserSide == pos.side_to_move());
while (b)
{
- s = pop_1st_bit(&b);
+ s = pop_lsb(&b);
sacptg = blockersCount = 0;
minKingDist = kingptg = 256;
// Compute plies from queening
- queeningSquare = relative_square(loserSide, make_square(file_of(s), RANK_8));
+ queeningSquare = relative_square(loserSide, file_of(s) | RANK_8);
movesToGo = rank_distance(s, queeningSquare) - int(relative_rank(loserSide, s) == RANK_2);
pliesToGo = 2 * movesToGo - int(loserSide == pos.side_to_move());
// How many plies does it take to remove all the blocking pawns?
while (blockers)
{
- blockSq = pop_1st_bit(&blockers);
+ blockSq = pop_lsb(&blockers);
movesToGo = 256;
// Check pawns that can give support to overcome obstacle, for instance
while (b2) // This while-loop could be replaced with LSB/MSB (depending on color)
{
- d = square_distance(blockSq, pop_1st_bit(&b2)) - 2;
+ d = square_distance(blockSq, pop_lsb(&b2)) - 2;
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;
+ d = square_distance(blockSq, pop_lsb(&b2)) - 2;
movesToGo = std::min(movesToGo, d);
}
// A couple of little helpers used by tracing code, to_cp() converts a value to
// a double in centipawns scale, trace_add() stores white and black scores.
- double to_cp(Value v) { return double(v) / double(PawnValueMidgame); }
+ double to_cp(Value v) { return double(v) / double(PawnValueMg); }
void trace_add(int idx, Score wScore, Score bScore) {