Advertisement
Guest User

Stockfish Game Phase Function

a guest
May 2nd, 2015
354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. /// Position::game_phase() calculates the game phase interpolating total non-pawn
  2. /// material between endgame and midgame limits.
  3.  
  4. Phase Position::game_phase() const {
  5.  
  6. Value npm = st->nonPawnMaterial[WHITE] + st->nonPawnMaterial[BLACK];
  7.  
  8. npm = std::max(EndgameLimit, std::min(npm, MidgameLimit));
  9.  
  10. return Phase(((npm - EndgameLimit) * PHASE_MIDGAME) / (MidgameLimit - EndgameLimit));
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement