2017 © Pedro Peláez
 

library tic-tac-toe-agent

A Tic Tac Toe Game

image

robertasproniu/tic-tac-toe-agent

A Tic Tac Toe Game

  • Friday, January 6, 2017
  • by robert.asproniu
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

tic-tac-toe agent

A PHP Tic Tac Toe Game package with AI included, (*1)

for installing just type:, (*2)

Installing

You can install the library via Composer, or by downloading it directly on GitHub., (*3)

Composer

Set up a Composer project, then run the following command:, (*4)

php composer.phar require robertasproniu/tic-tac-toe-agent

## Basic usage To create a game instance, use: ```php <?php require_once DIR . '/vendor/autoload.php'; // Composer // OR require_once DIR . '/src/TicTacToe.php'; // ZIP download, (*5)

use \TicTacToeAgent\TicTacToe; use \TicTacToeAgent\Board;, (*6)

$game = new TicTacToe(new Board()); // Create a new game ``` Now, you have created a new game with a empty board., (*7)

You can see the board by using the getBoard() method: php print_r( $game->getBoard() );, (*8)

Also you can set players symbols by accessing setPlayers() method: php $game->setPlayers(['X', 'O']);, (*9)

For getting recommended move for a player you need to pass board and player symbol by using makeMove(array $board, $player ) method: ```php $move = $game->makeMove(array_fill(0, 9, null), 'X'); // board can be multidimensional array too, (*10)

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

```, (*12)

The Versions

06/01 2017

dev-master

9999999-dev

A Tic Tac Toe Game

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

The Development Requires

by Robert Asproniu

06/01 2017

1.0.1

1.0.1.0

A Tic Tac Toe Game

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

The Development Requires

by Robert Asproniu