jawira/nice-maze-generator

Create a maze using ascii art

v1.0.0 2020-11-08 22:27 UTC

This package is not auto-updated.

Last update: 2024-11-04 17:21:30 UTC


README

Create a maze using ascii art.

Latest Stable Version .gitattributes composer.lock License

Usage

Use maze() function to create an array containing the maze.

<?php
// demo.php
require __DIR__ . '/vendor/autoload.php';

use function Jawira\NiceMazeGenerator\maze;
use function Jawira\NiceMazeGenerator\maze_to_string;

$arrayMaze  = maze(5, 20); // 5 rows, 20 columns
$stringMaze = maze_to_string($arrayMaze);

echo $stringMaze;

This is the output from previous code:

╭─────────────┬───────┬───┬───┬───────┬─╮
│             │       │   │   │       │ │
│ ╭─────┬─╴ ╷ ├─╴ ╭─╴ │ ╷ │ ╷ │ ╶─╮ ╷ │ │
│ │     │   │ │   │   │ │ │ │ │   │ │ │ │
│ │ ╭───╯ ╭─╯ │ ╭─┴─╮ ╵ │ ╵ │ ╰─╮ │ ╰─╯ │
│ │ │     │   │ │   │   │   │   │ │     │
│ ╵ │ ╶───┴─╮ ╵ │ ╷ ├───┴───┴─┬─╯ ├───┬─┤
│   │       │   │ │ │         │   │   │ │
├─╴ ╰─────╮ ╰───╯ │ ╵ ╶─────╮ ╵ ╶─╯ ╷ ╵ │
│         │       │         │       │   │
╰─────────┴───────┴─────────┴───────┴───╯

How to install

$ composer require jawira/nice-maze-generator

Contributing

  • If you liked this project, ⭐ star it on GitLab.
  • Issues are welcomed.

License

This library is licensed under the MIT license.