function calcRatingChanges(winnerRating, loserRating, winnerWins, loserWins) {
  let winnerRatingChange = 0;
  let loserRatingChange = 0;

  let winnerWinProb = 1.0 / (1.0 + Math.pow(10.0, (winnerRating - loserRating) / 100.0));
  let loserWinProb = 1.0 - winnerWinProb;

  for (let i = 0; i < winnerWins; i++) {
    winnerRatingChange += 4 * winnerWinProb;
    loserRatingChange -= 4 * winnerWinProb;
  }

  for (let i = 0; i < loserWins; i++) {
    winnerRatingChange -= 4 * loserWinProb;
    loserRatingChange += 4 * loserWinProb;
  }

  return [winnerRatingChange, loserRatingChange];
}
// rating adjustments for each player.
rating adjustments for each player.
rating adjustments for each player .
function calcRatingChanges(winnerRating, loserRating, winnerWins, loserWins) {
  let winnerRatingChange = 0;
  let loserRatingChange = 0;
  let winnerWinProb = 1.0 / (1.0 + Math.pow(10.0, (winnerRating - loserRating) / 100.0));
  let loserWinProb = 1.0 - winnerWinProb;
  for (let i = 0; i < winnerWins; i++) {
    winnerRatingChange += 4 * winnerWinProb;
    loserRatingChange -= 4 * winnerWinProb;
  }
  for (let i = 0; i < loserWins; i++) {
    winnerRatingChange -= 4 * loserWinProb;
    loserRatingChange += 4 * loserWinProb;
  }
  return [winnerRatingChange, loserRatingChange];
}
function calcRatingChanges ( winnerRating , loserRating , winnerWins , loserWins ) { let winnerRatingChange = 0 ; let loserRatingChange = 0 ; let winnerWinProb = 1.0 / ( 1.0 + Math . pow ( 10.0 , ( winnerRating - loserRating ) / 100.0 ) ) ; let loserWinProb = 1.0 - winnerWinProb ; for ( let i = 0 ; i < winnerWins ; i ++ ) { winnerRatingChange += 4 * winnerWinProb ; loserRatingChange -= 4 * winnerWinProb ; } for ( let i = 0 ; i < loserWins ; i ++ ) { winnerRatingChange -= 4 * loserWinProb ; loserRatingChange += 4 * loserWinProb ; } return [ winnerRatingChange , loserRatingChange ] ; }
rating adjustments for each player.
rating adjustments for each player .