Beispiel #1
0
$first_phase = 2 * $team_count - pow(2, ceil(log($team_count, 2)));
$second_phase = $team_count - $first_phase;
for ($x = 1; $x <= $team_count; $x++) {
    array_push($players1, 'T' . $x);
    shuffle($players1);
}
foreach ($players1 as $key => $value) {
    if ($key < $first_phase) {
        array_push($p1, $value);
    } else {
        array_push($p2, $value);
    }
}
$count = count($p1);
$courts = ["C1", "C2", "C3"];
$start_date = Scheduling::getStartTime($tour_id);
$winner_bracket = 'W';
$loser_bracket = 'L';
$start_time = date('Y-m-d H:i:s', strtotime($start_date));
$time = array();
array_push($time, $start_time, date('H:i:s', strtotime('+1 hour', strtotime($start_time))), date('H:i:s', strtotime('+2 hour', strtotime($start_time))), date('H:i:s', strtotime('+3 hour', strtotime($start_time))));
// Order players.
/* for ($i = 0; $i < log($count / 2, 2); $i++) {
        $out = array();

        foreach ($p1 as $player) {
            $splice = pow(2, $i);
			$out = array_merge($out, array_splice($p1, 0, $splice));
			$out = array_merge($out, array_splice($p1, -$splice));
        }