| '.$rec[0].' | '.CR; else $rowText .= TAB.TAB.''.$rec[0].' | '.CR; } else{ $rowText .= TAB.TAB.'<'.$elem.'>'.$rec[0].''.$elem.'>'.CR; $hasRowData = true; } for($col = $firstRatioCol;$col < $firstRatioCol + $showNumHistory;$col++){ if(isset($rec[$col])) $f = $rec[$col]; else $f = 0; $class = ''; if(!isset($tot_ratio[$col])) $tot_ratio[$col] = 0; if(!isset($diffs[0][$col])){ $diffs[0][$col] = array(); $diffs[1][$col] = array(); } if($row > 1){ if($f != 0){ if($f < 1000) // If the game ratio is a large number like in 'The Return of the Return of Dr.Sloth' the normal calculation isn't right, this could fix that $score1 = ceil(1000 / $f); // normal else $score1 = ceil(1000 * $f); // ratio is a large number $score2 = number_format($score1, 0); if($f < 1000) // Don't add large ratios to the total since there's only one and it makes the average seem crazy $tot_ratio[$col] += $f; $f = sprintf('%00.02f', $f); $ratiodiff = 0; if($col > 2){ // compute ratio difference if($rec[$col - 1] != 0){ if($rec[$col - 1] < 1000) $diff = $score1 - ceil(1000 / $rec[$col - 1]); else $diff = $score1 - ceil(1000 * $rec[$col - 1]); } else $diff = 0; $ratiodiff = $f - $rec[$col - 1]; if($ratiodiff > 0){ // Add to an array of good ratio changes $game = array(); $game['diff'] = $ratiodiff; $game['ratio'] = $f; $game['ratio2'] = $rec[$col - 1]; $game['name'] = $rec[0]; $diffs[0][$col][] = $game; } if($ratiodiff < 0){ // Add to an array of bad ratio changes $game = array(); $game['diff'] = $ratiodiff; $game['ratio'] = $f; $game['ratio2'] = $rec[$col - 1]; $game['name'] = $rec[0]; $diffs[1][$col][] = $game; } } else $diff = ''; if($diff > 0) $class = ' class="more"'; elseif($diff < 0) $class = ' class="less"'; elseif($diff == 0) $diff = ''; $rowText .= TAB.TAB."$score2 ($f) | ".CR; $hasRowData = true; } else $rowText .= TAB.TAB."<$elem$class align='right'> $elem>".CR; } else $rowText .= TAB.TAB."<$elem>$f$elem>".CR; } $rowText .= TAB.'
| Average Ratio | ' . CR; foreach($tot_ratio as $col=>$tot1){ $tot2 = number_format($tot1 / ($row - $skippedRows), 3); echo TAB.TAB.''.$tot2.' | '.CR; } echo TAB.'|
| Top 10 best ratio changes | '.CR; foreach($diffs[0] as $col=>$tot1){ if($col > count($diffs[0]) - $showNumHistory){ $top10=$diffs[0][$col]; usort($top10, 'diffCompare2'); $a = 0; echo TAB.TAB.'';
if(count($top10) == 0)
echo "There are no good changes?";
foreach($top10 as $item){
if(++$a > 10)
break;
echo $item["name"].' '; } echo ' | '.CR;
}
}
echo TAB.'|
| Top 10 worst ratio changes | '.CR; foreach($diffs[1] as $col=>$tot1){ if($col > count($diffs[1]) - $showNumHistory){ $top10=$diffs[1][$col]; usort($top10, 'diffCompare'); $a = 0; echo TAB.TAB.'';
if(count($top10) == 0)
echo "There are no bad changes?";
foreach($top10 as $item){
if(++$a > 10)
break;
echo $item['name'] . ' '; } echo ' | '.CR;
}
}
echo TAB.'