0)
// $stats[ $bots[ $row['black_id'] ][ 'name' ] ][ 'wins' ]++;
// else if ($row['score'] < 0)
// $stats[ $bots[ $row['white_id'] ][ 'name' ] ][ 'wins' ]++;
}
$statsql = "SELECT black_id, white_id, round(avg(score),1) as 'avg', sum(score) as 'sum', count(*) as 'games' FROM matchs group by black_id, white_id;";
$res = mysql_query($statsql);
while ($row = mysql_fetch_array($res)) {
$stats[] = $row;
$avg[$row['black_id']][$row['white_id']]['total'] += $row['sum'];
$avg[$row['black_id']][$row['white_id']]['games'] += $row['games'];
$avg[$row['black_id']][$row['white_id']]['avg'] = round($avg[$row['black_id']][$row['white_id']]['total']/$avg[$row['black_id']][$row['white_id']]['games'],2);
if ($row['black_id'] != $row['white_id']) {
$avg[$row['white_id']][$row['black_id']]['total'] += -$row['sum'];
$avg[$row['white_id']][$row['black_id']]['games'] += $row['games'];
$avg[$row['white_id']][$row['black_id']]['avg'] = round($avg[$row['white_id']][$row['black_id']]['total']/$avg[$row['white_id']][$row['black_id']]['games'],2);
}
}
function format_time($time_str)
{
if ($time_str == "0" or $time_str == null)
return "?";
else
return round($time_str, 2)."s";
}
?>
Return to Wiki
All Matchs
";
print "
$botname $botversion
";
print "
Wiki entry for $botname";
}/*
$bot = $stats[$botname];
print "
Wins | Percent |
";
print "";
print "".(isset($bot['wins']) ? $bot['wins'] : '0')."/".$bot['matchs'] . " | ".round($bot['wins']/$bot['matchs']*100)."% |
";
print "
";
} else {
print "
Bot Stats
";
print "
Bot | Wins | Percent |
";
foreach ($stats as $name => $bot) {
print "".$name." | ";
print "".(isset($bot['wins']) ? $bot['wins'] : '0')."/".$bot['matchs'] . " | ".round($bot['wins']/$bot['matchs']*100)."% |
";
$botname="";
}
print "
";
}*/
//print "
";
//print_r($avg);
//print "
";
print "
Agerage Scores
"; //These stats wont make sense if handicapping is added
print "
Black \ White | ";
foreach ($bots as $bot) {
if ($bot['version'] == $botversion || (!isset($botversion) && $bot['name'] == $botname))
{
print "";
} else if (!isset($botname)) {
print " | ";
} else {
print " | ";
}
print "".$bot['name']."";
print " - ".$bot['version']." | ";
}
foreach ($bots as $black) {
print "
---|
";
if ($black['version'] == $botversion || (!isset($botversion) && $black['name'] == $botname))
{
print "";
} else if (!isset($botname)) {
print " | ";
} else {
print " | ";
}
print "".$black['name']."";
print " - ".$black['version']." | ";
foreach ($bots as $white) {
if ($white['version'] == $botversion || $black['version'] == $botversion || (!isset($botversion) && ($white['name'] == $botname || $black['name'] == $botname)))
{
print "= 0) {
$score = "B+$score";
if ($black['name'] == $botname)
$score = "".$score."";
} else {
$score="W+".abs($score);
if ($white['name'] == $botname)
$score = "".$score."";
}
if (substr($score, 0, 1) == "W")
print " white\">".$score;
else
print " black\">".$score;
} else {
print " empty\">";
}
print " | \n";
}
print "
\n";
}
print "";
print "
";
/*
print "
";
*/
?>
Matchs
";
if (isset($_GET['name']))
{
$args = "name=".$_GET['name']."&";
} else if (isset($_GET['version'])) {
$args = "version=".$_Get['version']."&";
}
if (isset($_GET['page']))
{
print "
Prev";
print " -
Next";
} else {
print "
Next";
}
?>