mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-21 17:46:26 +08:00
Move game phase computation to MaterialInfo
Game phase is a strictly function of the material combination so its natural place is MaterialInfo, not position. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -255,7 +255,6 @@ public:
|
||||
// Incremental evaluation
|
||||
Score value() const;
|
||||
Value non_pawn_material(Color c) const;
|
||||
Phase game_phase() const;
|
||||
Score pst_delta(Piece piece, Square from, Square to) const;
|
||||
|
||||
// Game termination checks
|
||||
@@ -526,22 +525,6 @@ inline Value Position::non_pawn_material(Color c) const {
|
||||
return st->npMaterial[c];
|
||||
}
|
||||
|
||||
inline Phase Position::game_phase() const {
|
||||
|
||||
// Values modified by Joona Kiiski
|
||||
static const Value MidgameLimit = Value(15581);
|
||||
static const Value EndgameLimit = Value(3998);
|
||||
|
||||
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_passed_pawn_push(Move m) const {
|
||||
|
||||
Color c = side_to_move();
|
||||
|
||||
Reference in New Issue
Block a user