0,
'index' => 0,
'start' => 0,
'profile_load' => 0,
'calculations' => 0,
);
$benchmark_start = microtime(true);
$profile = $_POST['profile'];
$w = $_POST['W'];
$k = $_POST['K'];
$c = $_POST['C'];
$constantsDefined = false;
if(($w == 'W' || $k == 'K' || $c == 'C')&&($w != 'W' || $k != 'K' || $c != 'C')) {
//die ('if one constant is filled all constants need to be filled.');
$error = array('Constants','Entering one of the W, K, or C constants requires you to enter all of them.');
require 'index.php';
exit();
} elseif($w != 'W' && $k != 'K' && $c != 'C') {
$constantsDefined = true;
}
//require valid battle.net profile.
if(!preg_match('{^http://us|eu|tw|sea.battle.net}',$profile)) {
//die('throw error, not valid profile or region cannot be checked.');
$error = array('Battle.net Profile','You did not enter a valid Battle.net profile URL.');
require 'index.php';
exit();
}
$MAGIC_NUMBERS = array(
'bronze' => 500,
'silver' => 250,
'gold' => 250,
'platinum' => 250,
'diamond' => 475,
);
$MMR_NUMBERS = array(
'bronze' => 0,
'silver' => 1000,
'gold' => 1250,
'platinum' => 1500,
'diamond' => 1750,
'master' => 2225,
);
include_once 'lib/sc2profile.php';
$benchmark['start'] = microtime(true) - $benchmark_start;
$benchmark_start = microtime(true);
$sc2 = new sc2profile($profile);
$benchmark['profile_load'] = microtime(true) - $benchmark_start;
$benchmark_start = microtime(true);
if($sc2->getProfileFound()) {
$winPercent = $sc2->getGamesWon() / $sc2->getGamesPlayed();
$rankPointDifferential = 0;
if($constantsDefined) {
$rankPointDifferential = $sc2->getCharacterRating() + ($sc2->getBonusPool() * $w * 2) - findMaxBonusPool();
$matchMakingRating = $rankPointDifferential + $k + $c;
} else {
$rankPointDifferential = $sc2->getCharacterRating() + ($sc2->getBonusPool() * $winPercent * 2) - findMaxBonusPool();
$matchMakingRating = $rankPointDifferential + $MMR_NUMBERS[$sc2->getCharacterLeague()];
}
//only if we have a game history (require 10 minumum)
if(count($sc2->getMatchHistory()) >= 10) {
$averageWin = calculateAverageWin($sc2->getMatchHistory());
$averageLoss = calculateAverageLoss($sc2->getMatchHistory());
$gamesToPromotion = 5 + ($MAGIC_NUMBERS[$sc2->getCharacterLeague()] - $rankPointDifferential) / ($winPercent * $averageWin + ($winPercent - 1) * $averageLoss);
}
$obsGamesToPromotion = 5 + ($MAGIC_NUMBERS[$sc2->getCharacterLeague()] - $rankPointDifferential) / (24 * $winPercent - 11);
} else {
//die('profile not found or could not be read.');
$error = array('Profile','The profile you entered could not be read. Please recheck your Battle.net profile URL or try again later.');
require 'index.php';
exit();
}
$benchmark['calculations'] = microtime(true) - $benchmark_start;
$benchmark_start = microtime(true);
?>
Starcraft II Promotion Prediction
about
These results currently assume that you are playing in an average league. If your league strength differs,
your results will be inaccurate.
Currently, two predictions are displayed. The first prediction is based on an average of observed wins and
loss point values and assumes you will win 13 points and lose 11 points. The second is made using your played
games history. This can only be made if your Battle.net profile recently played history has enough games.
contact
your promotion
Rank Point Differential
Match Making Rating
Estimated games to promotion:
getCharacterLeague() == 'master') {
?>
You can not be promoted any further.
Based on observed win/loss averages: games to be promoted.
Based on your recently played trends:
games to be promoted.
Not enough data to predict.
Your MMR was calculated using MMR = P + U*W*2 - B + K + C with the following values: