Javascript implementation of Elo rating system