PHP code example of robertasproniu / tic-tac-toe-agent

1. Go to this page and download the library: Download robertasproniu/tic-tac-toe-agent library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

robertasproniu / tic-tac-toe-agent example snippets


 
  TicTacToeAgent\TicTacToe;
 use \TicTacToeAgent\Board;
 
 $game = new TicTacToe(new Board()); // Create a new game
 

 print_r( $game->getBoard() );
 

$game->setPlayers(['X', 'O']);
 

$move = $game->makeMove(array_fill(0, 9, null), 'X'); // board can be multidimensional array too

print_r($move); // [2,0,'X'] if available position else [];