Code: Select all
function num_teams_in_round($initial, $round)
{
return $initial * pow(.5, $round-1);
}
$participants = 32;
$rounds = round(log($participants, 2));
$num_matches_in_round = num_teams_in_round($participants, $whatever_round)/2;Moderator: General Moderators
Code: Select all
function num_teams_in_round($initial, $round)
{
return $initial * pow(.5, $round-1);
}
$participants = 32;
$rounds = round(log($participants, 2));
$num_matches_in_round = num_teams_in_round($participants, $whatever_round)/2;Code: Select all
<?php
$teams = 8;
$num_rounds = round(log($teams, 2))+1;
for ($i = 0; $i < $num_rounds; ++$i)
{
$matches = $teams*pow(.5, $i-1)/2;
for ($j = 0; $j < $matches; ++$j)
{
echo "<div style=\"border-style: inset;\"><span>Round $i Match $j</span></div>\n";
}
}
?>