protected function handleEndOfMatch(Game $game, FANNPlayer $p1, FANNPlayer $p2, Board $board)
 {
     $this->trainAI($this->gameStatus[$game->getResult()]);
     $p1->resetBoard();
     $p2->resetBoard();
     $newGame = $this->newGame($board, $p1, $p2);
     return $newGame;
 }
Example #2
0
 private function writeResult(Game $game)
 {
     $message = 'Winner was %s';
     if ($game->getResult() === TicTacToeGame::RESULT_PLAYER_1_WON) {
         $message = sprintf($message, 'Player 1');
     } elseif ($game->getResult() === TicTacToeGame::RESULT_PLAYER_2_WON) {
         $message = sprintf($message, 'Player 2');
     } else {
         $message = sprintf($message, 'Tie!');
     }
     $this->logger->info($message);
     $this->output->writeln($message);
 }