Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $teamA = 1550;
- $teamB = 1600;
- $radiantWon = 1;
- ratingCalc($teamA,$teamB,$radiantWon);
- function ratingCalc($teamA, $teamB, $radiantWon){
- $direWon = 1;
- if($radiantWon){
- $direWon = 0;
- }
- echo "a =".$teamA;
- echo "\n b =".$teamB;
- $kValue = 37;
- $rA = pow(10, $teamA/400);
- $rB = pow(10, $teamB/400);
- $expectedA = $rA/($rA + $rB);
- $expectedB = $rB/($rA + $rB);
- $teamA = $teamA + $kValue*($radiantWon - $expectedA);
- $teamB = $teamB + $kValue*($direWon - $expectedB);
- echo"\n rA = ".$rA."\n rb = ".$rB;
- echo "\n expectedA = ".$expectedA."\n expectedB = ".$expectedB;
- echo"\n newA =".$teamA."\n newB = ".$teamB;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement