mirror of
https://github.com/opelly27/Stockfish.git
synced 2026-05-20 03:57:45 +00:00
Move game_phase() to Position
It seems a more natural to place this function there. No functional change.
This commit is contained in:
@@ -465,6 +465,18 @@ const string Position::pretty(Move m) const {
|
||||
}
|
||||
|
||||
|
||||
/// Position::game_phase() calculates the game phase of the position
|
||||
|
||||
Phase Position::game_phase() const {
|
||||
|
||||
Value npm = st->npMaterial[WHITE] + st->npMaterial[BLACK];
|
||||
|
||||
return npm >= MidgameLimit ? PHASE_MIDGAME
|
||||
: npm <= EndgameLimit ? PHASE_ENDGAME
|
||||
: Phase(((npm - EndgameLimit) * 128) / (MidgameLimit - EndgameLimit));
|
||||
}
|
||||
|
||||
|
||||
/// Position::check_blockers() returns a bitboard of all the pieces with color
|
||||
/// 'c' that are blocking check on the king with color 'kingColor'. A piece
|
||||
/// blocks a check if removing that piece from the board would result in a
|
||||
|
||||
Reference in New Issue
Block a user