From 7104c57cd272751ac7b7d8c326f7c10c384e0cf3 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Wed, 30 Jul 2014 00:49:13 -0400 Subject: [PATCH] Initial commit --- contact.php | 18 ++ css/main.css | 266 +++++++++++++++++++++++++++ css/niftyCorners.css | 35 ++++ index.html | 14 ++ index.php.old | 311 +++++++++++++++++++++++++++++++ js/niftycube.js | 319 ++++++++++++++++++++++++++++++++ js/niftylayout.js | 5 + lib/divisionStandingsRegex.txt | 54 ++++++ lib/sc2profile.php | 182 ++++++++++++++++++ predict.php | 324 +++++++++++++++++++++++++++++++++ 10 files changed, 1528 insertions(+) create mode 100644 contact.php create mode 100644 css/main.css create mode 100644 css/niftyCorners.css create mode 100644 index.html create mode 100644 index.php.old create mode 100644 js/niftycube.js create mode 100644 js/niftylayout.js create mode 100644 lib/divisionStandingsRegex.txt create mode 100644 lib/sc2profile.php create mode 100644 predict.php diff --git a/contact.php b/contact.php new file mode 100644 index 0000000..b51e9b2 --- /dev/null +++ b/contact.php @@ -0,0 +1,18 @@ + \ No newline at end of file diff --git a/css/main.css b/css/main.css new file mode 100644 index 0000000..41be8cd --- /dev/null +++ b/css/main.css @@ -0,0 +1,266 @@ +body +{ + padding: 0px; + margin: 0px; + text-align: center; + background-color: #2A4480;/*#74aa81;*/ + color: #000000; +} + +body, div, td +{ + font-family: Verdana, Arial, Helvetica, sans-serif; +} + +img +{ + border: 0; +} + +a +{ + color: #000000; +} + +h1 +{ + font-size: 48px; + font-weight: bold; +} + +h2 +{ + font-size: 21px; + font-weight: bold; + padding: 0px; + margin: 0px; + border: 0px; + margin-bottom: 8px; + font-family: Verdana, Arial, Helvetica, sans-serif; + color: #06266F; /*#9bc1a4;*/ +} +h3 +{ + visibility: hidden; + display: none; +} + +table +{ + font-size: 11px; + color: #000000; +} + +div#header +{ + width: 979px; + text-align: right; + color: #6C8CD5; + margin: 0px auto; +} + +div#content +{ + background-color: #6C8CD5; /*#216332;*/ + text-align: left; + width: 979px; + margin: 0px auto; + padding-top: 8px; + padding-bottom: 8px; +} + +div#column1a +{ + width: 313px; + float: left; + padding-left: 10px; +} + +div#column1b +{ + width: 636px; + float: left; + padding-left: 10px; +} + +div#contact +{ + font-size: 24px; +} + +div#contactme +{ + position:relative; +} + +div#benchmark +{ + font-size: 11px; + color: #6C8CD5; +} + +div#copyright +{ + font-size: 11px; + color: #6C8CD5; +} + +.box +{ + padding: 5px; + margin: 5px; + background-color: #ffffff; + font-size: 11px; + color: #000000; +} + +.box a +{ + color: #6C8CD5; +} + +.box a:hover +{ + color: #06266F; +} + +.tweet +{ + font-size: 16px; +} + +.right +{ + float: right; + text-align:right; +} + +.center +{ + text-align: center; +} + +.justify +{ + text-align: justify; +} + +.clear +{ + clear: both; +} + +input.text { + font-family: Verdana, Arial, Helvetica, sans-serif; + background-color: #F0F0F0; + color: #06266F; + border: 2px solid #2A4480; + height:2em; + line-height:2em; + font-size:18px; + width: 90%; + text-align: center; +} + +input.optionaltext { + font-family: Verdana, Arial, Helvetica, sans-serif; + background-color: #F0F0F0; + color: #06266F; + border: 2px solid #2A4480; + height:2em; + line-height:2em; + font-size:18px; + width: 10%; + text-align: center; +} + +input.button { + font-family: Verdana, Arial, Helvetica, sans-serif; + background-color: #F0F0F0; + color: #06266F; + border: 2px solid #2A4480; + height:2em; + line-height:2em; + font-size:18px; +} + +input.contacttext { + font-family: Verdana, Arial, Helvetica, sans-serif; + background-color: #F0F0F0; + color: #06266F; + border: 2px solid #2A4480; + height:1em; + line-height:1em; + font-size:14px; + width: 90%; +} + +textarea.contactcomment { + font-family: Verdana, Arial, Helvetica, sans-serif; + background-color: #F0F0F0; + color: #06266F; + border: 2px solid #2A4480; + height:5em; + line-height:1em; + font-size:14px; + width: 90%; +} + +input.contactbutton { + font-family: Verdana, Arial, Helvetica, sans-serif; + background-color: #F0F0F0; + color: #06266F; + border: 2px solid #2A4480; + height:1.5em; + line-height:1em; + font-size:14px; +} + +.error { + margin-left:10px; + display: none; /* hide the errors */ + /* add some styling */ + padding:5px; + color: #D8000C; + font-size:12px; + background-color: #FFBABA; + width:90%; + /*position:absolute;*/ +} +.success { + margin-left:10px; + display: none; /* hide the sucess div */ + /* add some styling */ + padding:5px; + color: #044406; + font-size:12px; + background-color: #B7FBB9; + width:90%; + /*position:absolute;*/ +} +table.mmr { + border: 0; + width: 100%; +} +td.mmrHeading { + text-align: center; + font-weight: bold; + font-size: 18px; +} +td.mmrData { + text-align: center; + font-weight: bold; + font-size: 42px; +} +table.formula,td.formulaData { + border-color: #2A4489; + border-style: solid; +} +table.formula { + width:100%; + border-spacing: 0; + border-width: 0 0 2px 2px; +} +td.formulaData { + border-width: 2px 2px 0 0; +} \ No newline at end of file diff --git a/css/niftyCorners.css b/css/niftyCorners.css new file mode 100644 index 0000000..55523a4 --- /dev/null +++ b/css/niftyCorners.css @@ -0,0 +1,35 @@ +/*Nifty Corners Cube CSS by Alessandro Fulciniti +The following classes are added dinamically by javascript, +and their use should be avoided in the markup */ + +b.niftycorners,b.niftyfill{display:block} +b.niftycorners *{display:block;height: 1px;line-height:1px;font-size: 1px; + overflow:hidden;border-style:solid;border-width: 0 1px} +/*normal*/ +b.r1{margin: 0 3px;border-width: 0 2px} +b.r2{margin: 0 2px} +b.r3{margin: 0 1px} +b.r4{height: 2px} +b.rb1{margin: 0 8px;border-width:0 2px} +b.rb2{margin: 0 6px;border-width:0 2px} +b.rb3{margin: 0 5px} +b.rb4{margin: 0 4px} +b.rb5{margin: 0 3px} +b.rb6{margin: 0 2px} +b.rb7{margin: 0 1px;height:2px} +b.rb8{margin: 0;height:2px} +b.rs1{margin: 0 1px} +/*transparent inside*/ +b.t1{border-width: 0 5px} +b.t2{border-width: 0 3px} +b.t3{border-width: 0 2px} +b.t4{height: 2px} +b.tb1{border-width: 0 10px} +b.tb2{border-width: 0 8px} +b.tb3{border-width: 0 6px} +b.tb4{border-width: 0 5px} +b.tb5{border-width: 0 4px} +b.tb6{border-width: 0 3px} +b.tb7{border-width: 0 2px;height:2px} +b.tb8{border-width: 0 1px;height:2px} +b.ts1{border-width: 0 2px} \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..f3edb7d --- /dev/null +++ b/index.html @@ -0,0 +1,14 @@ + + + + + + + + + Currently not available. + + diff --git a/index.php.old b/index.php.old new file mode 100644 index 0000000..af4f481 --- /dev/null +++ b/index.php.old @@ -0,0 +1,311 @@ + 0, + 'index' => 0, + 'includes' => 0, + 'twitter' => 0, + 'lastfm' => 0, + 'hulu' => 0, + 'sc2ranks' => 0, + 'wow' => 0, + 'steam' => 0, + 'links' => 0, +); +$benchmark_start = microtime(true); + +include_once('lib/misc.php'); + +$db_config = json_decode(file_get_contents('conf/database.conf')); +include_once('lib/database.php'); +$db = new Database($db_config->hostname,$db_config->username,$db_config->password,$db_config->table); + +$benchmark['includes'] = microtime(true) - $benchmark_start; +$benchmark_start = microtime(true); + +include_once('lib/twitter.php'); +$twt = new Twitter; +$latest_tweet = $twt->get_latest_tweet('atomaka'); +$latest_tweet_since = time_since(strtotime($latest_tweet['created_at'])); + +$benchmark['twitter'] = microtime(true) - $benchmark_start; +$benchmark_start = microtime(true); + +include_once('lib/lastfm.php'); +$lfm = new Lastfm; +$latest_song = $lfm->get_latest_song('atomaka'); +$latest_song_since = ($latest_song['@attributes']['nowplaying']) ? 'Listening now' : time_since(strtotime($latest_song['date'] . ' UTC')) . ' ago'; +$latest_song_image = (is_array($latest_song['image'][1])) ? 'img/lastfm/blank_album64.png' : $latest_song['image'][1]; + +$benchmark['lastfm'] = microtime(true) - $benchmark_start; +$benchmark_start = microtime(true); + +include_once('lib/hulu.php'); +$hul = new Hulu; +$latest_hulu = $hul->get_latest_show('atomaka'); +$latest_hulu_since = time_since(strtotime($latest_hulu['pubdate'])); +preg_match('/get_team('Gaffer',888,1); + +$benchmark['sc2ranks'] = microtime(true) - $benchmark_start; +$benchmark_start = microtime(true); + +//$latest_achievement = $wow->get_latest_achievement('gaffer','crushridge'); + +$benchmark['wow'] = microtime(true) - $benchmark_start; +$benchmark_start = microtime(true); + +include_once('lib/steamclass.php'); +$stm = new Steam('76561197993725971'); +$steam = $stm->profile(); +$steam_games = $stm->recentgames(); + +$benchmark['steam'] = microtime(true) - $benchmark_start; +$benchmark_start = microtime(true); + +include_once('lib/links.php'); +$lnk = new Links($db); +$links = $lnk->get_latest_links(15); + +$benchmark['links'] = microtime(true) - $benchmark_start; +$benchmark_start = microtime(true); + + +?> + + + + + Who is Andrew? + + + + + + + + + + + +

+ +
+
+ +

contact

+
+ Email + AIM + Yahoo! + MSN + ICQ + Google Messaging + Skype +
+
+
+

twitter

+
+ Follow me on Twitter +
+ ago +
+
+

projects

+

project 1

+
+
+ + + + + +
+ sc2mmr + + sc2mmr

+ Predicts how many more games you will need to play to receive a league + promotion in Starcraft 2. +
+
+

project 2

+

+ content +

+

project 3

+

+ content +

+
+
+
+

random

+
+text; + + $link_text = preg_replace('/\[/','',$link_text); + $link_text = preg_replace('/\]/','',$link_text); + + echo '

' . $link_text . '

' . "\n"; + } +?> +
+
+
+

media

+
+ + + + + +
+ <?php echo $latest_song['artist'] ?> - <?php echo $latest_song['name'] ?> + + Last.fm +
+ by

+
+
+
+
+ + + + + +
+ <?php echo $latest_hulu['hulu']['show-name'] ?> - <?php echo $latest_hulu['hulu']['video-title'] ?> + + Hulu +
+ from

+ ago
+
+
+
+

games

+

World of Warcraft

+ +

Starcraft 2

+
+ + + + + + +
Starcraft 2 + Gaffer.888
+ +
+ points, Rank
+ wins
+ +
<?php echo ucfirst($team['league']) ?> League
+
+

Steam

+
+ + + + + +
Steam + Toppazz
+ hours in the last two weeks.
+ + : hours.
+ +
+
+
+
 
+
+
+ + 'none','time' => 0); +foreach($benchmark as $part=>$time) +{ + if($time > $max['time']) + { + $max['time'] = $time; + $max['part'] = $part; + } + $benchmark['total'] += $time; +} +?> +
Prepared in s. Damn you, (s)
+ +

+ + + +'; +?> \ No newline at end of file diff --git a/js/niftycube.js b/js/niftycube.js new file mode 100644 index 0000000..345a7e2 --- /dev/null +++ b/js/niftycube.js @@ -0,0 +1,319 @@ +/* Nifty Corners Cube - rounded corners with CSS and Javascript +Copyright 2006 Alessandro Fulciniti (a.fulciniti@html.it) + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +var niftyOk=(document.getElementById && document.createElement && Array.prototype.push); +var niftyCss=false; + +String.prototype.find=function(what){ +return(this.indexOf(what)>=0 ? true : false); +} + +var oldonload=window.onload; +if(typeof(NiftyLoad)!='function') NiftyLoad=function(){}; +if(typeof(oldonload)=='function') + window.onload=function(){oldonload();AddCss();NiftyLoad()}; +else window.onload=function(){AddCss();NiftyLoad()}; + +//commented out who knows if this was bad. +function AddCss(){ +niftyCss=true; +//var l=CreateEl("link"); +//l.setAttribute("type","text/css"); +//l.setAttribute("rel","stylesheet"); +//l.setAttribute("href","niftyCorners.css"); +//l.setAttribute("media","screen"); +//document.getElementsByTagName("head")[0].appendChild(l); +} + +function Nifty(selector,options){ +if(niftyOk==false) return; +if(niftyCss==false) AddCss(); +var i,v=selector.split(","),h=0; +if(options==null) options=""; +if(options.find("fixed-height")) + h=getElementsBySelector(v[0])[0].offsetHeight; +for(i=0;i0;i--) + d.appendChild(CreateStrip(i,side,color,border,btype)); +el.style.paddingBottom=0; +el.appendChild(d); +} + +function CreateStrip(index,side,color,border,btype){ +var x=CreateEl("b"); +x.className=btype+index; +x.style.backgroundColor=color; +x.style.borderColor=border; +if(side=="left"){ + x.style.borderRightWidth="0"; + x.style.marginRight="0"; + } +else if(side=="right"){ + x.style.borderLeftWidth="0"; + x.style.marginLeft="0"; + } +return(x); +} + +function CreateEl(x){ +return(document.createElement(x)); +} + +//added to fix ie8 width problem +function getIeVersion() { + var rv = -1; + if (navigator.appName == 'Microsoft Internet Explorer') { + var ua = navigator.userAgent; + var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); + if (re.exec(ua) != null) { + rv = parseFloat(RegExp.$1); + } + } + return rv; +} +//end add + +function FixIE(el){ +if(el.currentStyle!=null && el.currentStyle.hasLayout!=null && el.currentStyle.hasLayout==false) + //el.style.display="inline-block"; //removed to fix ie8 width problem + //added to fix ie8 width problem + var ver = getIeVersion(); + if (ver < 8) { + el.style.display="inline-block"; + } + //end add +} + +function SameHeight(selector,maxh){ +var i,v=selector.split(","),t,j,els=[],gap; +for(i=0;imaxh) maxh=els[i].offsetHeight; + els[i].style.height="auto"; + } +for(i=0;i0){ + t=CreateEl("b");t.className="niftyfill";t.style.height=gap+"px"; + nc=els[i].lastChild; + if(nc.className=="niftycorners") + els[i].insertBefore(t,nc); + else els[i].appendChild(t); + } + } +} + +function getElementsBySelector(selector){ +var i,j,selid="",selclass="",tag=selector,tag2="",v2,k,f,a,s=[],objlist=[],c; +if(selector.find("#")){ //id selector like "tag#id" + if(selector.find(" ")){ //descendant selector like "tag#id tag" + s=selector.split(" "); + var fs=s[0].split("#"); + if(fs.length==1) return(objlist); + f=document.getElementById(fs[1]); + if(f){ + v=f.getElementsByTagName(s[1]); + for(i=0;i + + + + + + + + (.*) + + + + + + + + + + SpacePenguin + + + + + + + + + + (.*) + + (.*) + + (.*) + + +ROWTEMPLATE; + $rowPattern = '{' . trim($rowTemplate) . '}m'; + + preg_match_all($rowPattern,$divisionHtml,$divisionMatches); \ No newline at end of file diff --git a/lib/sc2profile.php b/lib/sc2profile.php new file mode 100644 index 0000000..a6bce4e --- /dev/null +++ b/lib/sc2profile.php @@ -0,0 +1,182 @@ +bnetProfileLink = $profile; + else $this->bnetProfileLink = $profile . '/'; + $this->parseProfile(); + if($this->profileFound) { + $this->parseDivision(); + $this->parseMatchHistory(); + } + + } + + public function getDivisionLink() { + return $this->divisionLink; + } + + public function getCharacterName() { + return $this->characterName; + } + + public function getCharacterLeague() { + return $this->characterLeague; + } + + public function getGamesPlayed() { + return $this->gamesPlayed; + } + + public function getGamesWon() { + return $this->gamesWon; + } + + public function getBonusPool() { + return $this->bonusPool; + } + + public function getDivisionStandings() { + return $this->divisionStandings; + } + public function getMatchHistory($count = 0) { + if($count == 0) $count = count($this->matchHistory); + return array_slice($this->matchHistory,0,$count); + } + + public function getMaxBonusPool() { + return $this->maxBonusPool; + } + + public function getCharacterRating() { + return $this->characterRating; + } + + public function getProfileFound() { + return $this->profileFound; + } + + private function parseProfile() { + $profileHtml = @file($this->bnetProfileLink); + if(!$profileHtml) { + $this->profileFound = false; + return; + } + + $onesFound = false; + $divisionFound = false; + $characterFound = false; + foreach($profileHtml as $profileLine) { + if(!$characterFound) { + if(preg_match('{}',$profileLine,$characterMatch)) $characterFound = true; + } + if(preg_match('/#best-team-1/',$profileLine)) $onesFound = true; + if(!$onesFound) continue; + + if(!$divisionFound) { + if(preg_match('{a href="(.*)#current-rank">}',$profileLine,$divisionMatch))Record: (.*) - (.*)}',$profileLine,$recordMatch)) continue; + + break; + } + + preg_match('{(http://.*.battle.net)}',$this->bnetProfileLink,$regionMatch); + $this->divisionLink = $regionMatch[1] . $divisionMatch[1]; + $this->gamesPlayed = $recordMatch[1] + $recordMatch[2]; + $this->gamesWon = $recordMatch[1]; + $this->characterName = $characterMatch[1]; + $this->characterLeague = $divisionMatch[2]; + } + + private function parseDivision() { + $divisionStandings = array(); + $divisionHtml = file($this->divisionLink); + + $standingsHtml = array(); + $standingsCount = 0; + $standingsFound = false; + $bonusFound = false; + foreach($divisionHtml as $divisionLine) { + if(!$bonusFound) { + if(preg_match('{Bonus Pool: (.*)}',$divisionLine,$bonusMatch)) $bonusFound = true; + } + if(preg_match('//',$divisionLine)) $standingsFound = true; + if(!$standingsFound) continue; + if(preg_match('{
}',$divisionLine)) break; + + if(preg_match('{}',$divisionLine)) $standingsCount++; + $standingsHtml[$standingsCount] .= $divisionLine; + } + + $rankTemplate = <<.*.*(.*)
.*HighestRank:.*
PreviousRank:.*
FavoriteRace:.*(.*)(.*)(.*)} +RANKTEMPLATE; + + foreach($standingsHtml as $standingsLine) { + $standingsLine = preg_replace('/[\s]+/m','',$standingsLine); + + preg_match($rankTemplate,$standingsLine,$standingMatch); + + array_shift($standingMatch); + $divisionStandings[] = $standingMatch; + + if($standingMatch[1] == $this->characterName) $this->characterRating = $standingMatch[2]; + } + + $this->divisionStandings = $divisionStandings; + $this->bonusPool = $bonusMatch[1]; + } + + private function parseMatchHistory() { + $matches = array(); + $matchHistoryHtml = file($this->bnetProfileLink . 'matches'); + + $matchHtml = array(); + $matchesFound = false; + $matchCount = 0; + foreach($matchHistoryHtml as $matchHistoryLine) { + if(preg_match('//',$matchHistoryLine)) $matchesFound = true; + if(!$matchesFound) continue; + if(preg_match('{
}',$matchHistoryLine)) break; + + if(preg_match('{}',$matchHistoryLine)) $matchCount++; + $matchHtml[$matchCount] .= $matchHistoryLine; + } + + array_shift($matchHtml); + array_shift($matchHtml); + + + $matchTemplate = <<Type:1v1
Speed:Faster.*1v1.*\((.*)\).*} +MATCHTEMPLATE; + + foreach($matchHtml as $matchLine) { + $matchLine = preg_replace('/[\s]+/m','',$matchLine); + + preg_match($matchTemplate,$matchLine,$matchMatch); + + if($matchMatch[1] != '') $matches[] = $matchMatch[1]; + } + + $this->matchHistory = $matches; + } +} + +?> diff --git a/predict.php b/predict.php new file mode 100644 index 0000000..b10049b --- /dev/null +++ b/predict.php @@ -0,0 +1,324 @@ + 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

+
+
+
+ +
Please enter a valid email.
+

+
Please enter a comment.
+
+ +
Please try again later.
+

+
+
Thank your for your feedback.
+
+
+
+
+

your promotion

+
+ + + + + + + + + +
Rank Point DifferentialMatch 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: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PRank PointsgetCharacterRating(); ?>
UUnspent Bonus PoolgetBonusPool(); ?>
WWin Percentage
BTotal Bonus Pool
KDivison Modifier
CLeague Conversion ConstantgetCharacterLeague()] : $c ?>
+ +
+

predict again

+
+
+
+

+ Enter the following values only if you know what you are doing:

+ + +

+ +

+
+
+
 
+
+
+ 'none','time' => 0); +foreach($benchmark as $part=>$time) +{ + if($time > $max['time']) + { + $max['time'] = $time; + $max['part'] = $part; + } + $benchmark['total'] += $time; +} +?> +
Prepared in s.
+ +

+ + + + 0) { + $wins++; + $winsTotal += ($match / 2); + } + } + + return $winsTotal / $wins; +} + +function calculateAverageLoss($matches) { + $losses = 0; + $lossesTotal = 0; + foreach($matches as $match) { + if($match < 0) { + $losses++; + $lossesTotal += $match; + } + } + + return abs($lossesTotal) / $losses; +} +?> \ No newline at end of file