Beispiel #1
0
<?php

require_once 'php_include/db_connection.php';
require_once 'classes/AllClasses.php';
$event_id = 1;
$tour_id = 2;
//Set round for each game
$team_count = Scheduling::getTeamCount($tour_id);
$players1 = array();
$players = array();
$p1 = array();
$p2 = array();
$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));
Beispiel #2
0
 public static function getRobinRounds($tour_id)
 {
     global $conn;
     $team_count = Scheduling::getTeamCount($tour_id);
     if ($team_count % 2) {
         //odd case
         $rounds = $team_count;
         $match_per_round = ($team_count - 1) / 2;
     } else {
         //even case
         $rounds = $team_count - 1;
         $match_per_round = $team_count / 2;
     }
     $game_detail['rounds'] = $rounds;
     $game_detail['match_per_round'] = $match_per_round;
     return $match_per_round;
 }