r/chessprogramming • u/Legitimate_Pickle_82 • 17h ago
Technical How to define the stages of the game reliably, with consistent accuracy?
Im creating a chess analysis tool that can search for a player accross multiple platforms (Chess.com, Stockfish, etc...), then can analyse their games at mass within a period (usually a month). Its currently able to show an overview including the win rates for player colour, rating progression over the month, opponent analysis (av elo for wins, av elo for loss, etc...), and analysis of the openings.
How should I define the stages of the game to then perform detailed analysis? Like Opening is anywhere from 8-15 moves and I can then search those moves into an opening library to find their names, so thats easy enough.
But how to define where the middlegame ends and where the endgame starts? Its not as simple as seeing if the Queens are still on the board, so do I need to find the total value of captured pieces and then if that is over value x, then say we have moved to the endgame?
Thanks for anyhelp here, I am at a bit of a loss as to how we can define it.