Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ELO calculation / Write "regenerate scores" task #12

Open
MarcLapierre opened this issue Oct 20, 2016 · 1 comment
Open

Fix ELO calculation / Write "regenerate scores" task #12

MarcLapierre opened this issue Oct 20, 2016 · 1 comment

Comments

@MarcLapierre
Copy link
Owner

The ELO calculations seem off.

Replace ELO gem with manual calculation.
Write task to recalculate all scores. (Match history table?)

@MarcLapierre
Copy link
Owner Author

MarcLapierre commented Oct 20, 2016

view-source:http://www.3dkingdoms.com/chess/elo.htm

function CalculateRatingChange()

{

var Elo1 = document.rating.elo1.value * 1;

var Elo2 = document.rating.elo2.value * 1;

var K = document.rating.K.value * 1;

var EloDifference = Elo2 - Elo1;

var percentage = 1 / ( 1 + Math.pow( 10, EloDifference / 400 ) );

var win = Math.round( K * ( 1 - percentage ) );

var draw = Math.round( K * ( .5 - percentage ) );

if (win > 0 ) win = "+" + win;

if (draw > 0 ) draw = "+" + draw;

document.ratingchange.win.value = win;

document.ratingchange.draw.value = draw;

document.ratingchange.loss.value = Math.round( K * ( 0 - percentage ) );

document.ratingchange.percent.value =  Math.round( percentage * 100 ) + "%";

}

This was referenced Oct 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant