How does Stockfish define phases of the game?

Sort:
Avatar of CalanWilliams

I was reading up on Stockfish, and noticed it has different piece values for middlegame and endgame.  How does Stockfish define the difference between opening, middlegame and endgame in a methodological way that a computer can understand?

Avatar of Farm_Hand

I imagine whatever you read was giving you the simple version.

Yes the piece values change as the games goes on, but the list of things the engine takes into account is enormous. For example every time a pawn leaves the board, rooks get a small bonus, and knights get a small demerit. Maybe 0.05 of a pawn. Really intricate stuff like that. The change can even depend on whether it was a rook pawn or knight pawn. Maybe rook pawns subtract 0.02 from a knight. I don't know.

Anyway, yes, by the time the endgame is happening stockfish is using different evals, but it's based on dozens if not hundreds of little tweaks like that which have been happening on every move.

Avatar of drmrboss

They use scale factor for transition between Middle Game Evaluation table and Endgame Evaluation table.

https://hxim.github.io/Stockfish-Evaluation-Guide/