The engine of the tic tac tog game
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
- Docker >= v17.05
- php >= 7.2
composer require andreluizmachado/tictactoe-library
To get the next move by bot:
use AndreLuizMachado\TicTacToe\Engine\Bot;
...
$bot = new Bot(
[ //previous plays of current game
[
'column' => 3,
'line' => 3,
],
]
);
$nextPlay = $bot->getNextPlay();
var_dump($nextPlay);
....
To check the board
use AndreLuizMachado\TicTacToe\Engine\Board;
use AndreLuizMachado\TicTacToe\Engine\Player;
...
$player2 = new Player(
[
[
'column' => 3,
'line' => 2,
],
[
'column' => 3,
'line' => 3,
],
]
);
$player1 = new Player(
[
[
'column' => 1,
'line' => 1,
],
[
'column' => 1,
'line' => 2,
],
[
'column' => 1,
'line' => 3,
],
]
);
$board = new Board($player1, $player2);
$game = $board->checkGame();
var_dump($game);
....
./run-install.sh
./run-testing.sh