ladders.js
/**
	 * Internal method. Update the Elo rating of a user.
	 */
Internal method. Update the Elo rating of a user.
Internal method . Update the Elo rating of a user .
updateRow(row, score, foeElo) {
		let elo = row[1];
		let K = 50;
		if (elo < 1200) {
			if (score < 0.5) {
				K = 10 + (elo - 1000) * 40 / 200;
			} else if (score > 0.5) {
				K = 90 - (elo - 1000) * 40 / 200;
			}
		} else if (elo > 1350) {
			K = 40;
		} else if (elo > 1600) {
			K = 32;
		}
		let E = 1 / (1 + Math.pow(10, (foeElo - elo) / 400));
		elo += K * (score - E);
		if (elo < 1000) elo = 1000;
		row[1] = elo;
		if (score > 0.6) {
			row[3]++; 
		} else if (score < 0.4) {
			row[4]++; 
		} else {
			row[5]++; 
		}
		row[6] = '' + new Date();
	}
updateRow ( row , score , foeElo ) { let elo = row [ 1 ] ; let K = 50 ; if ( elo < 1200 ) { if ( score < 0.5 ) { K = 10 + ( elo - 1000 ) * 40 / 200 ; } else if ( score > 0.5 ) { K = 90 - ( elo - 1000 ) * 40 / 200 ; } } else if ( elo > 1350 ) { K = 40 ; } else if ( elo > 1600 ) { K = 32 ; } let E = 1 / ( 1 + Math . pow ( 10 , ( foeElo - elo ) / 400 ) ) ; elo += K * ( score - E ) ; if ( elo < 1000 ) elo = 1000 ; row [ 1 ] = elo ; if ( score > 0.6 ) { row [ 3 ] ++ ; } else if ( score < 0.4 ) { row [ 4 ] ++ ; } else { row [ 5 ] ++ ; } row [ 6 ] = '' + new Date ( ) ; }
Internal method.
Internal method .
// The K factor determines how much your Elo changes when you win or // lose games. Larger K means more change. // In the "original" Elo, K is constant, but it's common for K to // get smaller as your rating goes up // dynamic K-scaling (optional) // main Elo formula // win // loss // tie