PHP Classes

How to Implement a PHP Tic-Tac-Toe Game that Can Be Played by Multiple Players Using the Package Tic Tac Toe Multiplayer: Manage the interactions ofTic-Tac-Toe game players

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-06-11 (10 months ago) RSS 2.0 feedNot enough user ratingsTotal: 26 This week: 1All time: 11,235 This week: 42Up
Version License PHP version Categories
tic-tac-toe-multipla 1.0.0BSD License7Games, PHP 7
Description 

Author

This package can manage the moves of multiple Tic-Tac-Toe players.

It can render a Tic-Tac-Toe game board on a Web page for different players in the same game.

The package can also generate a page that can send HTTP requests using Websockets to send the player moves and update the board according to other players until the game ends.

Picture of Stanley Aloh
Name: Stanley Aloh <contact>
Classes: 4 packages by
Country: Nigeria Nigeria

Example

<?php
   
use Ratchet\Server\IoServer;
    use
Ratchet\Http\HttpServer;
    use
Ratchet\WebSocket\WsServer;
    use
MyApp\Chat;

   
$rootDirectory = __DIR__;
   
    require
__DIR__ .'/vendor/autoload.php';
    require
$rootDirectory . '/models/player.php';
    require
$rootDirectory . '/models/Board.php';
    require
$rootDirectory . '/models/player_board.php';
    require
$rootDirectory . '/models/Registrar.php';
    require
$rootDirectory . '/controller/Game_controller.php';
    require
$rootDirectory . '/Chat.php';

   
$server = IoServer::factory(
        new
HttpServer(
            new
WsServer(
                new
Chat()
            )
        ),
       
8080
   
);

   
$server->run();


Details

tic-tac-toe-Multiplayer

This Project enhances the Tic-tac-toe game into a multiplayer game over the network powered by Webhsocket to enable realtime update and play by two players

using RatchetIO Ratchet

To run

Goto command line, navigate to folder


Goto browser and type

You can try on more than one browser to test multiplayer


  Files folder image Files (1072)  
File Role Description
Files folder imageassets (4 directories)
Files folder imagecontroller (1 file)
Files folder imagemodels (4 files)
Files folder imagetext (4 files)
Files folder imageutils (1 file)
Files folder imagevendor (1 file, 9 directories)
Plain text file Chat.php Class Class source
Accessible without login Plain text file index.html Data Board page
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file server.php Example Example script

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:26
This week:1
All time:11,235
This week:42Up