Skip to content

andreluizmachado/tictactoe-library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tic Tac Toe Library

The engine of the tic tac tog game

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

  • Docker >= v17.05
  • php >= 7.2

Installing

composer require andreluizmachado/tictactoe-library

Usage

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);
    ....

Running the tests

./run-install.sh 
./run-testing.sh

Authors

André Luiz Machado

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published