strtr($gameTermP, "tp", "TP"), 1 => "Upcoming", 2 => "History", 3 => "MapList", 4 => "Standings", 5 => "Ranking", 6 => "Rules", 7 => "News", 8 => "About", ); $nWName = 170; $nWSpace = 8; //$noDataSign = "[N/I]"; $noDataSign = ""; $show = "Standings"; extract ($_GET, EXTR_OVERWRITE); extract ($_POST, EXTR_OVERWRITE); ?>
$Button\n"; ?>
\n"; ?>

Tournament Rules


by

Rules have not been posted yet.
\n"; else while( $news = mysql_fetch_assoc( $resid ) ) { echo "\n"; echo "\n"; echo "\n"; echo "\n"; } ?>

Tournament News


No News have been Posted yet.
{$news["Title"]} [posted: {$news["CreatedF"]}]"; // only show that the article was modified if it was edited a minute later or more if( $news["LastModified"] - $news["Created"] > 60 ) echo " [updated: {$news["LastModifiedF"]}]"; echo "
by {$news["Author"]}
{$news["Body"]}
 
Unscheduled Played Single Elim :
Double Elim :
Scheduled Drop In


0, date_format(b.Timestamp, '%b %D %h:%i %p'), 0) as Timestamp, p.Nick, b.PlayerID " ."from pbs_bracket b " ."left join pbs_players p on (b.PlayerID = p.ID) " ."left join pbs_rounds r on (r.BracketID = b.ID and r.MapID) " ."group by b.ID order by b.ID"; $rBracket = db_query ($query); if (!mysql_num_rows ($rBracket)) { showHint ("Section Disabled", "bracket has not been seeded with players yet, section disabled.
", 200); exit; } ?>

Tastyspleen Nade I


"; //print_r ($aPlayers); //echo ""; $arrGraph = array(); $bColor = array (); for ($i = 0; $i < $nSERows; $i ++) $bColor []= false; ?>". $label .""; } else echo "width=\"$nWSpace\"> "; echo ""; } ?> 1 && $aPlayers[$nPlayerID]["PlayerID"]) $arrGraph[$i * $nSERows + ($j - 2)] = 3; else if( $aPlayers[$nPlayerID]["Timestamp"] ) $arrGraph[$i * $nSERows + ($j - 2)] = 4; } $sub += $powlookup[$j/2]; } else { if (($i-$sub2) % $powlookup[($j-1)/2+1] == 0) { $bWas = $bColor[$j]; $bColor[$j] = !$bColor[$j]; } if ($bColor[$j] || $bWas) $arrGraph[$i * $nSERows + $j] = 2; $sub2 += $powlookup[($j-1)/2]; } } } $nPlayerID = 0; $WBStandingString = ""; for ($i = 0; $i < $nColumns; $i ++) { echo ""; for ($j = 0; $j < $nRows; $j ++) { $bHasText = false; $bHasOption = false; $bHasTime = false; $bHasRef = false; $bHasLink = false; $sClass = ""; if ($arrGraph[$i * $nRows + $j] == 1) { $nPlayerID ++; $sClass = "td_played"; $bHasText = true; if (!$aPlayers[$nPlayerID]["PlayerID"]) { if (!$aPlayers[$nPlayerID]["Timestamp"]) $sClass = "td_unsched"; else $sClass = "td_sched"; if ($aPlayers[$nPlayerID]["RefID"] > 0) $bHasRef = true; if ($bHasRef && $bHasTime) $sClass = "td_sched"; } } else if ($arrGraph[$i * $nRows + $j] == 2) { if ($sClass != "td_unsched") $sClass = "td_br"; } else if ($arrGraph[$i * $nRows + $j] == 3) { $bHasLink = true; } else if( $arrGraph[$i * $nRows + $j] == 4 ) { $bHasTime = true; } $rowSpan = 0; $bDrawTD = false; if ($arrGraph[$i * $nRows + $j] == 2) { if ($bRowStep[($j+1)/2] == 0) { # top bridge corner $bRowStep[($j+1)/2] = 1; $rowSpan = 1; $bDrawTD = true; $nrcoff = $j == 1 ? 1 : $j-1; # next row center offset from top bridge corner if( $arrGraph[($i+$nrcoff) * $nRows + ($j-1)] == 4 ) { $sClass = "td_br_es"; $bBridgeFocus[($j+1)/2] = 2; } else{ $bBridgeFocus[($j+1)/2] = $arrGraph[($i+$nrcoff) * $nRows + ($j-1)] == 3 ? 1 : 0; $sClass = $bBridgeFocus[($j+1)/2] ? "td_br_e_f" : "td_br_e_b"; } } else if ($bRowStep[($j+1)/2] == 1) { # center of bridge $bRowStep[($j+1)/2] = -($powlookup[(($j-1)/2)+1]-1); $rowSpan = ($powlookup[(($j-1)/2)+1]-1); $bDrawTD = true; # is the center focused or not? $sClass = $bBridgeFocus[($j+1)/2] ? "td_br_c_f" : "td_br_c_b"; $sClass = $bBridgeFocus[($j+1)/2] == 2 ? "td_br_cs" : $sClass; } else if ($bRowStep[($j+1)/2] == -1) { # bottom bridge corner $bRowStep[($j+1)/2] = 0; $rowSpan = 1; $bDrawTD = true; $sClass = $bBridgeFocus[($j+1)/2] ? "td_br_e_f" : "td_br_e_b"; $sClass = $bBridgeFocus[($j+1)/2] == 2 ? "td_br_es" : $sClass; $bBridgeFocus[($j+1)/2] = 0; } else $bRowStep[($j+1)/2] += 1; if ($bDrawTD) { echo ""; } // for (j) echo ""; }// for (i) ?>
"; } } else if ($bHasLink && $bAltView) { echo ""; if ($aPlayers[$nPlayerID+1]["Rounds"]) echo "↑[Match Details]↓"; else echo "$noDataSign"; } elseif( $bHasTime ) { echo ""; echo "Scheduled For →"; } else { echo ""; $bDrawTD = true; } if ($bDrawTD) if ($bHasText) { if ($aPlayers[$nPlayerID]["PlayerID"]) { if ($j && !$bAltView && $aPlayers[$nPlayerID]["Rounds"]) { echo ""; } else echo "(" . $aPlayers[$nPlayerID]["PlayerID"] . ") " . ShortenString( $aPlayers[$nPlayerID]["Nick"], 20 ) . ""; } else { if ($aPlayers[$nPlayerID]["Timestamp"]) echo $aPlayers[$nPlayerID]["Timestamp"]; else echo " "; } } else echo " "; // place anchor echo ""; echo "



The Losers Bracket: Losers vs New Losers


"; for ($i = 0; $i < $nDERows; $i ++) { echo ""; } echo ""; for ($i = 0; $i < $nColumns; $i ++) { echo ""; for ($j = 0; $j < $nRows; $j ++) { $id = $j * $nColumns + $i; $bHasText = false; $bHasTime = false; $bHasRef = false; $bHasLink = false; $bIsTBA = false; $sClass = ""; $bWas[$j] = $abCon[$j]; if ($aPlayers[$nPlayerID]["Timestamp"]) $Nick = $aPlayers[$nPlayerID]["Timestamp"]; else $Nick = "Not Scheduled"; if ($arrGraph[$id] == 1) { // normal winner $nPlayerID ++; $bHasText = true; $abCon[$j] = !$abCon[$j]; $sClass = "td_played"; if ($aPlayers[$nPlayerID]["PlayerID"]) { $Nick = "(".$aPlayers[$nPlayerID]["PlayerID"].") ". ShortenString( $aPlayers[$nPlayerID]["Nick"], 20 ) . ""; } else { if (!$aPlayers[$nPlayerID]["Timestamp"]) $sClass = "td_unsched"; else $sClass = "td_sched"; if ($aPlayers[$nPlayerID]["Timestamp"]) $bHasTime = true; else $bHasTime = false; if ($aPlayers[$nPlayerID]["RefID"] > 0) $bHasRef = true; if ($bHasRef && $bHasTime) $sClass = "td_sched"; } if ($j == $nRows - 1) $nSpotIDLoser = $nPlayerID; } else if ($arrGraph[$id] == 2) { // drop in from loser bracket $nPlayerID ++; $sClass = "td_dropin"; $bHasText = true; $abCon[$j] = !$abCon[$j]; if ($aPlayers[$nPlayerID]["PlayerID"]) { $Nick = "(".$aPlayers[$nPlayerID]["PlayerID"].") ". ShortenString( $aPlayers[$nPlayerID]["Nick"], 20 ) . ""; } else { if ($aPlayers[$nPlayerID]["Timestamp"]) $bHasTime = true; else $bHasTime = false; if ($aPlayers[$nPlayerID]["RefID"] > 0) $bHasRef = true; if ($bHasRef && $bHasTime) $sClass = "td_sched"; } } else if ($arrGraph[$id] == 3) { // altview thing $bHasLink = true; if( $bAltView && $bHasLink && $aPlayers[$nPlayerID + 1]["PlayerID"] ) $sClass = "td_view"; elseif( $bAltView && $bHasLink && $aPlayers[$nPlayerID + 1]["Timestamp"] ) $sClass = "td_view"; } if ($j % 2 == 1) { if ($bWas[$j - 1] || $abCon[$j - 1]) { $sClass = "td_br"; $bWas[$j - 1] = false; } } $rowSpan = 0; $bDrawTD = false; echo ""; $bDrawTD = true; if ($bDrawTD) if ($bHasText) { if ($aPlayers[$nPlayerID]["PlayerID"]) { if (!$bIsTBA) { if (!$bAltView) { echo ""; } else echo $Nick; } } else { if ($bHasTime) echo $aPlayers[$nPlayerID]["Timestamp"]; else if ($bIsTBA) echo "Not Scheduled"; else echo " "; } } else if ($bAltView && $bHasLink && $aPlayers[$nPlayerID + 1]["PlayerID"]) { if ($aPlayers[$nPlayerID + 1]["Rounds"]) echo "↑[Match Details]↓"; else echo $noDataSign; } elseif( $bHasLink && $aPlayers[$nPlayerID + 1]["Timestamp"] ) { echo "Scheduled For →"; } else echo " "; echo ""; } // for j echo ""; } // for i ?>
round " . (($i % 4) ? "L" : "L") . ($i / 2 + 1) . ""; else echo "width=\"$nWSpace\"> "; echo "
" . ShortenString( $aPlayers[$nSpotIDWinner]["Nick"], 20 ) . ""; $sNick1 = "" . ShortenString( $aPlayers[$nSpotIDLoser]["Nick"], 20 ) . ""; $nWinnerID = $nSpotIDFinal; $bHasTime = ($aPlayers[$nWinnerID]["Timestamp"]) ? true : false; $bHasRef = ($aPlayers[$nWinnerID]["RefID"]) ? true : false; if ($aPlayers[$nWinnerID]["PlayerID"]) $class = "td_played"; else if ($bHasTime) $class = "td_sched"; else $class = "td_unsched"; if( $aPlayers[$nWinnerID]["PlayerID"] ) { // played $br_e ="td_br_e_f"; $br_c ="td_br_c_f"; } elseif( $aPlayers[$nWinnerID]["Timestamp"] ) { // scheduled $br_e ="td_br_es"; $br_c ="td_br_cs"; } else { // unscheduled $br_e ="td_br_e_b"; $br_c ="td_br_c_b"; } ?>


Final Match: Winner Bracket vs Loser Bracket



   
Match Details]↓"; } else echo $noDataSign; } else echo " "; ?>  
" . $aPlayers[$nWinnerID]["Nick"] . ""; ?> [View]
   


Putty's Bracket SystemTM
© 2002-2003 chk-putty
All rights reserved.


Matches Review System


Seed Team Name History
" . ShortenString( $arrPlayer["Nick"], 20 ) . ""; ?> [=" title="Access Match Records">Access]


10)) $perRow = 1; //echo "
";
		//print_r ($arrMatches);
		//echo "
"; ?>

Accessing
 
"; } ?>
Members
" . $teamEntry["Name"]; if ($teamEntry["Captain"] == 'Y') echo " *"; echo "
 
* = team captain


Roster N/A."; ?>
"> " . ShortenString( $arrMatch[0]["WinNick"], $LONGEST_NAME_IN_MATCH_REVIEWS ) . ""; $LoseInfo = "".ShortenString( $arrMatch[0]["LoseNick"], $LONGEST_NAME_IN_MATCH_REVIEWS ) . " (".$arrMatch[0]["LoseID"].")"; $numCol ++; // lookahead for all scores $runningSum = 0; foreach ($arrMatch as $round) { $runningSum += $round["WinnerScore"]; } // if winner's score for all the rounds is 0, no info must of been submitted! if (!$runningSum) { // cant use width in no info row cause of cellspacin :< ?> = $perRow) { $numCol = 0; echo "\n"; } } // end of foreach (matches) if ($numCol < $perRow) echo "\n"; // just for sanity ?>
No Info!
         
[">View]
 
  You can find this team at:


No Match Data Available.
"; if (isset ($teamChan)) { if (strlen ($teamChan)) echo "

You can find this team at: $teamChan
"; else echo "

No team irc-channel specified.
"; } } } ?>
0, "numPlayed" => 0); $MPMap1 = array ("MapID" => 0, "numPlayed" => 0); $MPMap2 = array ("MapID" => 0, "numPlayed" => 0); if (mysql_num_rows ($rMPMap) > 1) { // take top 2 and see if first one is bigger, if not its a tie (cant have second bigger than first :) $MPMap1 = mysql_fetch_assoc ($rMPMap); $MPMap2 = mysql_fetch_assoc ($rMPMap); if ($MPMap1["numPlayed"] > $MPMap2["numPlayed"]) $MPMap = $MPMap1; } else $MPMap = mysql_fetch_assoc ($rMPMap); // get the numbre of times the maps were picked as first choice $query = "select MapID, count(MapID) as numPlayed from pbs_rounds where SequenceNum = 1 and MapID group by MapID order by numPlayed desc"; $rFirstChoice = db_query ($query); $arr1stChoice = array(); while( $row = mysql_fetch_assoc( $rFirstChoice ) ) $arr1stChoice[$row["MapID"]]= $row["numPlayed"]; // most common first choice list( $MCFC["MapID"], $MCFC["numPlayed"] ) = each( $arr1stChoice ); $query = "select BracketID, MapID, abs(WinnerScore - LoserScore) as minScoreDiff, WinnerScore, LoserScore " ."from pbs_rounds where MapID group by minScoreDiff limit 1"; $result = db_query ($query); $ClosestGame = mysql_fetch_assoc ($result); $query = "select BracketID, MapID, abs(WinnerScore - LoserScore) as maxScoreDiff, WinnerScore, LoserScore " ."from pbs_rounds where MapID group by maxScoreDiff desc limit 1"; $result = db_query ($query); $FurthestGame = mysql_fetch_assoc ($result); ?>
AwardCharacteristic
MCFCMost Common First Choice
MPMMost Played Map (not shown during a tie)
CGClosest Game on a Map
BGBiggest Blowout Game on a Map

link]"; ?>
" border="0" class="map_image">
\n"; if( ! isset( $arr1stChoice[$arrMap["ID"]] ) ) $arr1stChoice[$arrMap["ID"]] = 0; $times = ($arr1stChoice[$arrMap["ID"]] == 1) ? "time" : "times"; echo "First Choice: ".$arr1stChoice[$arrMap["ID"]]." $times
\n"; if ($arrMap["maxScoreDiff"]) echo "Biggest Score Diff: ".$arrMap["maxScoreDiff"]."
\n"; if ($arrMap["minScoreDiff"]) echo "Smallest Score Diff: ".$arrMap["minScoreDiff"]."
\n"; ?>
* MCFC (".$MCFC["numPlayed"].")
\n"; if ($MPMap["MapID"] == $arrMap["ID"]) echo "* MPM
\n"; if ($ClosestGame["MapID"] == $arrMap["ID"]) echo "* CG (".$ClosestGame["WinnerScore"]." vs ".$ClosestGame["LoserScore"].")
\n"; if ($FurthestGame["MapID"] == $arrMap["ID"]) echo "* BG (".$FurthestGame["WinnerScore"]." vs ".$FurthestGame["LoserScore"].")
\n"; ?>
 
Match History for
"> 1 "> 1 Score Map Name "> 2 Score "> 2
">View

" ."" ."" ."" ."" ."" ."" ."" ."" ."" ."\n"; echo ""; $lastIDs = $curIDs; } ?>
Known Match History
1   2   Result   Map Name
"> vs
{$round["p1Nick"]}vs{$round["p2Nick"]}:{$round["WinnerScore"]}to{$round["LoserScore"]}on{$round["MapName"]}

Upcoming Matches
"> 1 "> 2 ">Time ">Referee Assigned
no matches coming up!
{$upcoming["p1Name"]}"; ?> {$upcoming["p2Name"]}"; ?>

SDI - Score Difference Index
Takes rounds played into account :]

Sort: Desc / Asc


" border="0" class="td_sched">
Games Played SDI


"; aboutBox(); } else if ($show == "Ranking") { $query = "select r.WinnerPID, r.LoserPID, sum(r.WinnerScore-r.LoserScore) as ScoreDiff, p1.Nick as WinnerNick, p2.Nick as LoserNick " ."from pbs_rounds r " ."left join pbs_players p1 on (r.WinnerPID = p1.ID) " ."left join pbs_players p2 on (r.LoserPID = p2.ID) " ."group by r.WinnerPID, r.LoserPID"; $res = db_query ($query); $arrRanking = array(); if (mysql_error()) echo mysql_error(); else { $arrData = array(); // queer but this makes the sql query so simple while ($row = mysql_fetch_assoc ($res)) $arrData []= $row; foreach ($arrData as $row) { if (!isset ($arrRanking[$row["WinnerPID"]])) { //if ($row["WinnerPID"] == 5) //echo "setting " . $row["ScoreDiff"] . "
\n"; $row["Nick"] = $row["WinnerNick"]; $row["PID"] = $row["WinnerPID"]; $row["MWon"] = 1; //$row["ScoreDiff"] = 0; //unset ($row["LoserPID"]); $arrRanking[$row["WinnerPID"]] = $row; } else { //if ($row["WinnerPID"] == 5) //echo "adding " . $row["ScoreDiff"] . "
\n"; $arrRanking[$row["WinnerPID"]]["ScoreDiff"] += $row["ScoreDiff"]; $arrRanking[$row["WinnerPID"]]["MWon"] ++; } } foreach ($arrData as $row) { if (!isset ($arrRanking[$row["LoserPID"]])) { //echo "LOSER! " . $row["LoserPID"] . "
\n"; $row["Nick"] = $row["LoserNick"]; $row["PID"] = $row["LoserPID"]; $row["MWon"] = -1; $row["ScoreDiff"] = -$row["ScoreDiff"]; $arrRanking[$row["LoserPID"]] = $row; } else { //if ($row["LoserPID"] == 5) //echo "subtracting " . $row["ScoreDiff"] . "
\n"; $arrRanking[$row["LoserPID"]]["ScoreDiff"] -= $row["ScoreDiff"]; $arrRanking[$row["LoserPID"]]["MWon"] --; } } } function cmpRanks ($a, $b) { // incase of a tie check score diffs if ($a["MWon"] == $b["MWon"]) if ($a["ScoreDiff"] > $b["ScoreDiff"]) return -1; if ($a["MWon"] > $b["MWon"]) return -1; return 1; } echo "
";
		usort ($arrRanking, "cmpRanks");
		//print_r ($arrRanking);
		echo "
"; ?>

Bracket Path Length Ranking..

Rank (Seed) Nick MW NSD
".$ranked["Nick"].""; ?>


ranking is computed by number of rounds won.
the tie-breaker is the net score difference
between wins and loses. props to zzjzz for the algo :D