- return npMaterial[c];
-}
-
-inline Phase Position::game_phase() const {
-
- // The purpose of the Value(325) terms below is to make sure the difference
- // between MidgameLimit and EndgameLimit is a power of 2, which should make
- // the division at the end of the function a bit faster.
- static const Value MidgameLimit = 2 * QueenValueMidgame
- + 2 * RookValueMidgame
- + 6 * BishopValueMidgame
- + Value(325);
-
- static const Value EndgameLimit = 4 * RookValueMidgame - Value(325);
-
- Value npm = non_pawn_material(WHITE) + non_pawn_material(BLACK);
-
- if (npm >= MidgameLimit)
- return PHASE_MIDGAME;
- else if(npm <= EndgameLimit)
- return PHASE_ENDGAME;
- else
- return Phase(((npm - EndgameLimit) * 128) / (MidgameLimit - EndgameLimit));
-}
-
-inline bool Position::move_is_deep_pawn_push(Move m) const {
-
- Color c = side_to_move();
- return piece_on(move_from(m)) == pawn_of_color(c)
- && relative_rank(c, move_to(m)) > RANK_4;
-}
-
-inline bool Position::move_is_pawn_push_to_7th(Move m) const {
-
- Color c = side_to_move();
- return piece_on(move_from(m)) == pawn_of_color(c)
- && relative_rank(c, move_to(m)) == RANK_7;