Guest User

Untitled

a guest
Jun 24th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1.  
  2. function eloCalc ($ratingA, $ratingB, $winner) {
  3. $qA = 10^($ratingA/400);
  4. $qB = 10^($ratingB/400);
  5.  
  6. $expectedA = $qA / ($qA + $qB);
  7. $expectedB = $qA / ($qA + $qB);
  8. if ($winner == 1) { $scoreA = 1; $scoreB = 0; }
  9. else { $scoreA = 0; $scoreB = 1; }
  10.  
  11. $newRatingA = $ratingA + ($c * ($scoreA - $expectedA));
  12. $newRatingB = $ratingB + ($c * ($scoreB - $expectedB));
  13. return whatever
  14. }
Add Comment
Please, Sign In to add comment