jawira/nice-maze-generator

使用 ascii 艺术创建迷宫

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

This package is not auto-updated.

Last update: 2024-09-09 16:32:28 UTC


README

使用 ascii 艺术创建迷宫。

Latest Stable Version .gitattributes composer.lock License

用法

使用 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;

这是前面代码的输出

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

如何安装

$ composer require jawira/nice-maze-generator

贡献

许可证

此库遵循MIT 许可证