Skip to content

Commit

Permalink
Merge pull request #954 from jacksonthall22/more-accurate-winning-chance
Browse files Browse the repository at this point in the history
Update cp multiplier to match Lichess implementation
  • Loading branch information
niklasf committed Jan 26, 2023
2 parents 57c9f87 + bc1c55a commit d13921c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion chess/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,9 @@ def _sf12_wins(cp: int, *, ply: int) -> int:
return int(0.5 + 1000 / (1 + math.exp((a - x) / b)))

def _lichess_raw_wins(cp: int) -> int:
return round(1000 / (1 + math.exp(-0.004 * cp)))
# https://github.com/lichess-org/lila/pull/11148
# https://github.com/lichess-org/lila/blob/2242b0a08faa06e7be5508d338ede7bb09049777/modules/analyse/src/main/WinPercent.scala#L26-L30
return round(1000 / (1 + math.exp(-0.00368208 * cp)))


class Cp(Score):
Expand Down

0 comments on commit d13921c

Please sign in to comment.