Maze/README.md

31 lines
617 B
Markdown
Raw Permalink Normal View History

2023-11-20 00:18:02 +01:00
# PHP Maze Generator
A simple and minimalistic maze generator
## Installation
```shell
composer require Osmal/Maze
```
## Usage
**Basic Usage:**
```php
require __DIR__ . '/vendor/autoload.php';
$width = 15;
$height = 15;
$maze = new Osmal\Maze\Generator($width,$height);
$maze->print();
```
**You can also make your own display logic:**
```php
echo '<pre>';
foreach ($maze->getMaze() as $row) {
foreach ($row as $cell) {
echo $cell ? '<span style="background-color: #000;">&nbsp;&nbsp;</span>' : '<span style="background-color: #fff;">&nbsp;&nbsp;</span>';
}
echo '<br>';
}
echo '</pre>';
```