Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/infinitypaul/tower_of_hanoi
https://github.com/infinitypaul/tower_of_hanoi
Last synced: 14 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/infinitypaul/tower_of_hanoi
- Owner: infinitypaul
- Created: 2024-10-17T22:39:19.000Z (21 days ago)
- Default Branch: main
- Last Pushed: 2024-10-17T23:00:53.000Z (21 days ago)
- Last Synced: 2024-10-20T09:52:04.583Z (19 days ago)
- Language: PHP
- Size: 73.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Tower of Hanoi
A simple pyramid puzzle
## 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
```2. Install dependencies via composer.
```
composer install
```4. Run php server.
```
php artisan serve
```
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```
### LicenseThe Tower of Hanoi is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)