Exemplo n.º 1
0
 /**
  * Resetting the game.
  */
 public function newGame()
 {
     // Reset the board.
     $this->board->reset();
     $this->savePlayBoard();
     // Unset the winner.
     unset($this->winner);
     unset($this->settings->winner);
 }
Exemplo n.º 2
0
 /**
  * @param $fields
  * @dataProvider unusedFieldsDataProvider
  */
 public function testFindUnusedFields($fields, $expected)
 {
     $board = new Board($fields);
     $this->assertSame($expected, $board->findUnusedFields());
 }
Exemplo n.º 3
0
 /**
  * @param  Board $board
  * @return int $field
  */
 public function findBestMove(Board $board)
 {
     $unusedFields = $board->findUnusedFields();
     shuffle($unusedFields);
     return $unusedFields[0];
 }