Exemple #1
0
 /**
  * @param array $table
  */
 public function __construct($table = [])
 {
     if (sizeof($table) != 0) {
         $this->table = $table;
     } else {
         $helper = new TableHelper();
         $this->table = $helper->createTable();
     }
 }
Exemple #2
0
 /**
  * We expect every player to win against drunk player
  * @dataProvider getData
  * @param string $name
  */
 public function testWinAgainstDrunkPlayer($name)
 {
     if ($name == 'drunk') {
         return;
         // we do not want drunk to player to play against himself
     }
     $player = PlayerRegistry::getDefaultPlayers()->get($name);
     $utility = new TableHelper();
     $game = new Game($utility->createTable());
     $game->addPlayer($player);
     $game->addPlayer(new DrunkPlayer(), PlayerInterface::SYMBOL_O);
     $this->assertEquals(PlayerInterface::SYMBOL_X, $game->autoPlay());
 }
Exemple #3
0
 /**
  * Test if empty table creation works
  */
 public function testCreateEmptyTable()
 {
     $utility = new TableHelper();
     $this->assertEquals([[null, null, null], [null, null, null], [null, null, null]], $utility->createTable());
 }