This is a python implementation of the "Fighting Chess Index" defined by David Smerdon in this post, which is a measure of the combativeness of top chess players. The script takes in PGN files as input and calculates average Elo rating, average draw length, short draw rates (fewer than 32 moves) and draws with white for each player.
These draw metrics are reduced to a single score by PCA, which is then used as the dependent variable in a linear regression model with average Elo and Elo difference from opponents as predictors. The model's residuals represent combativeness deviation from Elo-based expectations. These residuals are inverted and rescaled between 0 and 100 to obtain the final FCI where higher values signify greater combativeness.
-
Install the required packages:
pip install python-chess pandas numpy scikit-learn
-
If you want to filter by average Elo or require a minimum number of games, change these lines in
fci.py
:player_stats = player_stats[player_stats['eloav'] >= 2500] # filter by min average elo player_stats = player_stats[player_stats['N'] >= 1] # filter by minimum number of games
-
Replace
folder
with the path to your folder of PGN files in this line before runningfci.py
:pgn_files = glob.glob('folder/*.pgn')