andreluizmachado / tictactoe-library
此包的最新版本(dev-master)没有提供许可证信息。
井字棋引擎
dev-master
2018-03-19 14:33 UTC
Requires
- php: ^7.2
Requires (Dev)
- phpunit/phpunit: ^7.0
This package is not auto-updated.
Last update: 2024-10-02 10:56:31 UTC
README
井字棋游戏引擎
入门指南
以下说明将帮助您在本地机器上获取项目副本,并用于开发和测试。
先决条件
- Docker >= v17.05
- php >= 7.2
安装
composer require andreluizmachado/tictactoe-library
使用方法
通过机器人获取下一步操作
use AndreLuizMachado\TicTacToe\Engine\Bot; ... $bot = new Bot( [ //previous plays of current game [ 'column' => 3, 'line' => 3, ], ] ); $nextPlay = $bot->getNextPlay(); var_dump($nextPlay); ....
检查棋盘
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