elo

cmdline fide-elo calculator in C
Log | Files | Refs

commit 4f464f5b8da73f2cf4d93c4714a14ae44460b203
parent 4608f67a7c24ce9df226f10464043a21021bcd54
Author: Joakim <joakim@jnisse.xyz>
Date:   Mon, 15 Apr 2024 13:23:41 +0200

Fixed >400 diff bug. (Potential issue with 400 >diff >=383.

Diffstat:
Melo.c | 5++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/elo.c b/elo.c @@ -40,19 +40,18 @@ int main(int argc, char **argv) res = strtof(ropt,NULL); diff = myelo - opprating; diff = roof(&diff); - const int caps[41] = {7,14,21,29,36,43,50,57,65,72,80,87,95,102,110,117,125,133,141,149,158,166,175,184,193,202,211,220,230,240,251,262,273,284,296,309,322,336,351,366,383}; + const int caps[42] = {7,14,21,29,36,43,50,57,65,72,80,87,95,102,110,117,125,133,141,149,158,166,175,184,193,202,211,220,230,240,251,262,273,284,296,309,322,336,351,366,383,400}; int offset=0; int p=50; if (diff < 0) { offset =100; diff = -diff; } - for (int i=0;i<41;++i) { + for (int i=0;i<42;++i) { if (diff >= caps[i]) {p++;} } - p++; if (offset){ p = offset -p;} printf("%3.2f\n", (float)kfactor*(100*res-p)/100); exit(0);