Example #1
0
 /**
  * {@inheritDoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $gameType = $input->getArgument(self::ARGUMENT_GAME_TYPE);
     $gamePlayers = $input->getArgument(self::ARGUMENT_GAME_PLAYERS);
     //create a table with players
     $table = new Table();
     //add players to the table
     for ($i = 1; $i <= $gamePlayers; $i++) {
         $table->addPlayer(new CasualPlayer('player ' . $i));
     }
     //create a new game
     switch ($gameType) {
         case Sevens::GAME_NAME:
             // add new game to the table
             $table->addCardGame(new Sevens(new Deck()));
             //output information
             $output->writeln("\nA new game of " . Sevens::gameName() . " " . "has been created with " . $table->getPlayerCount() . " " . "player/s! and an unshuffled deck.\n");
             break;
     }
     //if the table has a game then continue
     if ($table->hasCardGame()) {
         //ask if the deck should be shown
         $this->showDeck($output, $table);
         //ask if the deck should be shuffled
         $this->shuffleDeck($output, $table);
         //ask if the round should begin
         $this->beginRound($output, $table);
     }
 }