예제 #1
0
 /**
  * \param N number of players to be created for the tournament
  *
  * \param team_colours Array of string with teams colours eg. ["red", 
  * "blue"]
  *
  * \brief Creates $N players assigned to teams defined with $team_colours
  *
  * Constructor create an instance of team class for each value fo $team_colours
  * and $N players are constructed and randomly assigned to one of the 
  * teams
  */
 public function __construct($N, $team_colours)
 {
     $this->number_of_players = $N;
     foreach ($team_colours as $colour) {
         $this->teams[] = new team($colour);
         $this->number_of_teams++;
     }
     $players = [];
     while (player::getCount() < $N) {
         $players[] = new player();
     }
     $this->assign_players($players);
 }