PHP Classes

How to Solve the Tower of Hanoi Puzzle Online Using the Package Tower of Hanoi: Implement the Tower of Hanoi game on the Web

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-10-22 (23 hours ago) RSS 2.0 feedNot enough user ratingsTotal: 2 This week: 2All time: 11,465 This week: 23Up
Version License PHP version Categories
tower_of_hanoi 1.0The PHP License7Games, Web services, PHP 7
Description 

Author

This package can implement the Tower of Hanoi game on the Web.

It implements an application that displays the Tower of Hanoi game screen on a Web page.

The package also implements an API that can take requests to process the play moves to update the game screen page.

Picture of Edward Paul
  Performance   Level  
Name: Edward Paul <contact>
Classes: 19 packages by
Country: Nigeria Nigeria
Innovation award
Innovation award
Nominee: 11x

Winner: 1x

Example

<?php

use Illuminate\Http\Request;

define('LARAVEL_START', microtime(true));

// Determine if the application is in maintenance mode...
if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
    require
$maintenance;
}

// Register the Composer autoloader...
require __DIR__.'/../vendor/autoload.php';

// Bootstrap Laravel and handle the request...
(require_once __DIR__.'/../bootstrap/app.php')
    ->
handleRequest(Request::capture());


Details

<h1 align="center">Tower of Hanoi</h1> <p align="center"> A simple pyramid puzzle</p>

<p>&nbsp;</p>

Download Instruction

> Application Requirements * PHP >= 8.2 * A web server like Apache or Nginx * Composer for dependency management.

  1. Clone the project.
git clone https://github.com/infinitypaul/tower_of_hanoi.git projectname

  1. Install dependencies via composer.
composer install 

  1. Run php server.
php artisan serve

<p>&nbsp;</p>

Enjoy!

Api Usage

Notes: - http://localhost:8000/ is your base URL. Replace it with your server's base URL if necessary. - No persistence is needed across requests. The game resets if the server restarts.

GET http://localhost:8000/api/state

Description: Retrieves the current state of the Tower of Hanoi game, including the positions of the disks on the rods and whether the game is over.

POST http://localhost:8000/api/move/{from}/{to}

Description: Moves a disk from one rod (from) to another rod (to).

Where: * {from}: The rod from which you want to move a disk (1-based index). * {to}: The rod to which you want to move the disk (1-based index).

Testing

php artisan test

You should see the results of the tests, ensuring that the application works as expected.

Static Analysis

This project uses PHPStan for static code analysis to ensure code quality and prevent errors

vendor/bin/phpstan analyse

License

The Tower of Hanoi is open-sourced software licensed under the MIT license


  Files folder image Files (51)  
File Role Description
Files folder imageapp (4 directories)
Files folder imagebootstrap (2 files)
Files folder imageconfig (11 files)
Files folder imagedatabase (3 directories)
Files folder imagepublic (3 files)
Files folder imageresources (3 directories)
Files folder imageroutes (3 files)
Files folder imagetests (1 file, 2 directories)
Accessible without login Plain text file .editorconfig Data Auxiliary data
Accessible without login Plain text file .env.example Data Auxiliary data
Accessible without login Plain text file artisan Example Example script
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file package.json Data Auxiliary data
Accessible without login Plain text file phpstan.neon Data Auxiliary data
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file postcss.config.js Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file tailwind.config.js Data Auxiliary data
Accessible without login Plain text file vite.config.js Data Auxiliary data

  Files folder image Files (51)  /  app  
File Role Description
Files folder imageHttp (1 directory)
Files folder imageModels (1 file)
Files folder imageProviders (1 file)
Files folder imageServices (1 file)

  Files folder image Files (51)  /  app  /  Http  
File Role Description
Files folder imageControllers (2 files)

  Files folder image Files (51)  /  app  /  Http  /  Controllers  
File Role Description
  Plain text file Controller.php Class Class source
  Plain text file TowerOfHanoiController.php Class Class source

  Files folder image Files (51)  /  app  /  Models  
File Role Description
  Plain text file User.php Class Class source

  Files folder image Files (51)  /  app  /  Providers  
File Role Description
  Plain text file AppServiceProvider.php Class Class source

  Files folder image Files (51)  /  app  /  Services  
File Role Description
  Plain text file TowerOfHanoiService.php Class Class source

  Files folder image Files (51)  /  bootstrap  
File Role Description
  Accessible without login Plain text file app.php Example Example script
  Plain text file providers.php Class Class source

  Files folder image Files (51)  /  config  
File Role Description
  Accessible without login Plain text file app.php Aux. Configuration script
  Plain text file auth.php Class Class source
  Accessible without login Plain text file cache.php Aux. Configuration script
  Accessible without login Plain text file database.php Aux. Configuration script
  Accessible without login Plain text file filesystems.php Aux. Configuration script
  Plain text file logging.php Class Class source
  Accessible without login Plain text file mail.php Aux. Configuration script
  Accessible without login Plain text file queue.php Aux. Configuration script
  Plain text file sanctum.php Class Class source
  Accessible without login Plain text file services.php Aux. Configuration script
  Accessible without login Plain text file session.php Aux. Configuration script

  Files folder image Files (51)  /  database  
File Role Description
Files folder imagefactories (1 file)
Files folder imagemigrations (4 files)
Files folder imageseeders (1 file)

  Files folder image Files (51)  /  database  /  factories  
File Role Description
  Plain text file UserFactory.php Class Class source

  Files folder image Files (51)  /  database  /  migrations  
File Role Description
  Plain text file 0001_01_01_000000_create_users_table.php Class Class source
  Plain text file 0001_01_01_000001_create_cache_table.php Class Class source
  Plain text file 0001_01_01_000002_create_jobs_table.php Class Class source
  Plain text file 2024_10_16_233428_...ss_tokens_table.php Class Class source

  Files folder image Files (51)  /  database  /  seeders  
File Role Description
  Plain text file DatabaseSeeder.php Class Class source

  Files folder image Files (51)  /  public  
File Role Description
  Accessible without login Plain text file .htaccess Data Auxiliary data
  Accessible without login Plain text file index.php Example Example script
  Accessible without login Plain text file robots.txt Doc. Documentation

  Files folder image Files (51)  /  resources  
File Role Description
Files folder imagecss (1 file)
Files folder imagejs (2 files)
Files folder imageviews (1 file)

  Files folder image Files (51)  /  resources  /  css  
File Role Description
  Accessible without login Plain text file app.css Data Auxiliary data

  Files folder image Files (51)  /  resources  /  js  
File Role Description
  Accessible without login Plain text file app.js Data Auxiliary data
  Accessible without login Plain text file bootstrap.js Data Auxiliary data

  Files folder image Files (51)  /  resources  /  views  
File Role Description
  Accessible without login Plain text file welcome.blade.php Aux. Configuration script

  Files folder image Files (51)  /  routes  
File Role Description
  Accessible without login Plain text file api.php Appl. Application script
  Accessible without login Plain text file console.php Appl. Application script
  Accessible without login Plain text file web.php Appl. Application script

  Files folder image Files (51)  /  tests  
File Role Description
Files folder imageFeature (2 files)
Files folder imageUnit (2 files)
  Plain text file TestCase.php Class Class source

  Files folder image Files (51)  /  tests  /  Feature  
File Role Description
  Plain text file ExampleTest.php Class Class source
  Plain text file TowerOfHanoiTest.php Class Class source

  Files folder image Files (51)  /  tests  /  Unit  
File Role Description
  Plain text file ExampleTest.php Class Class source
  Plain text file TowerOfHanoiControllerTest.php Class Class source

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:2
This week:2
All time:11,465
This week:23Up