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   View files Example   View files View files (1072)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-06-11 (Yesterday) RSS 2.0 feedNot yet rated by the usersTotal: Not yet counted Not yet ranked
Version License PHP version Categories
tic-tac-toe-multipla 1.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: 3 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  
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

 Version Control Unique User Downloads  
 100%
Total:0
This week:0