fix : game elo estimation

This commit is contained in:
GuillaumeSD
2025-05-09 23:52:20 +02:00
parent 2cc8b48b08
commit e37152e651
8 changed files with 136 additions and 70 deletions

View File

@@ -78,8 +78,12 @@ const getAccuracyWeights = (movesWinPercentage: number[]): number[] => {
const getMovesAccuracy = (movesWinPercentage: number[]): number[] =>
movesWinPercentage.slice(1).map((winPercent, index) => {
const lastWinPercent = movesWinPercentage[index];
const winDiff = Math.abs(lastWinPercent - winPercent);
const isWhiteMove = index % 2 === 0;
const winDiff = isWhiteMove
? Math.max(0, lastWinPercent - winPercent)
: Math.max(0, winPercent - lastWinPercent);
// Source: https://github.com/lichess-org/lila/blob/a320a93b68dabee862b8093b1b2acdfe132b9966/modules/analyse/src/main/AccuracyPercent.scala#L44
const rawAccuracy =
103.1668100711649 * Math.exp(-0.04354415386753951 * winDiff) -
3.166924740191411;