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