X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.cpp;h=bda83d7a138f8a6dc8c80b7b99a8bb75382e9d36;hp=5df07a092433c3dd1975102722840fb696a110fe;hb=bf485f4affc37cd408a65b66b8a3aad059bad5f3;hpb=05513a66410f96959f3a6e70be9aea72425cf7c7 diff --git a/src/position.cpp b/src/position.cpp index 5df07a09..bda83d7a 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -450,19 +450,6 @@ const string Position::fen() const { } -/// Position::game_phase() calculates the game phase interpolating total non-pawn -/// material between endgame and midgame limits. - -Phase Position::game_phase() const { - - Value npm = st->nonPawnMaterial[WHITE] + st->nonPawnMaterial[BLACK]; - - npm = std::max(EndgameLimit, std::min(npm, MidgameLimit)); - - return Phase(((npm - EndgameLimit) * PHASE_MIDGAME) / (MidgameLimit - EndgameLimit)); -} - - /// Position::slider_blockers() returns a bitboard of all the pieces (both colors) /// that are blocking attacks on the square 's' from 'sliders'. A piece blocks a /// slider if removing that piece from the board would result in a position where @@ -1006,10 +993,8 @@ bool Position::see_ge(Move m, Value threshold) const { assert(is_ok(m)); - // Castling moves are implemented as king capturing the rook so cannot be - // handled correctly. Simply assume the SEE value is VALUE_ZERO that is always - // correct unless in the rare case the rook ends up under attack. - if (type_of(m) == CASTLING) + // Only deal with normal moves, assume others pass a simple see + if (type_of(m) != NORMAL) return VALUE_ZERO >= threshold; Square from = from_sq(m), to = to_sq(m); @@ -1018,16 +1003,8 @@ bool Position::see_ge(Move m, Value threshold) const { Value balance; // Values of the pieces taken by us minus opponent's ones Bitboard occupied, stmAttackers; - if (type_of(m) == ENPASSANT) - { - occupied = SquareBB[to - pawn_push(~stm)]; // Remove the captured pawn - balance = PieceValue[MG][PAWN]; - } - else - { - balance = PieceValue[MG][piece_on(to)]; - occupied = 0; - } + balance = PieceValue[MG][piece_on(to)]; + occupied = 0; if (balance < threshold) return false;