Code: Select all
inline Score Position::value() const {
return st->value + (side_to_move() == WHITE ? TempoValue / 2 : -TempoValue / 2);
}
BTW:
I think that In the function:
Code: Select all
/// Position::move_attacks_square() tests whether a move from the current
/// position attacks a given square.
bool Position::move_attacks_square(Move m, Square s) const {
assert(move_is_ok(m));
assert(square_is_ok(s));
Bitboard occ, xray;
Square f = move_from(m), t = move_to(m);
assert(square_is_occupied(f));
if (bit_is_set(attacks_from(piece_on(f), t), s))
return true;
// Move the piece and scan for X-ray attacks behind it
occ = occupied_squares();
do_move_bb(&occ, make_move_bb(f, t));
xray = ( (rook_attacks_bb(s, occ) & pieces(ROOK, QUEEN))
|(bishop_attacks_bb(s, occ) & pieces(BISHOP, QUEEN)))
& pieces_of_color(color_of_piece_on(f));
// If we have attacks we need to verify that are caused by our move
// and are not already existent ones.
return xray && (xray ^ (xray & attacks_from<QUEEN>(s)));
}