jawira / nice-maze-generator
使用 ascii 艺术创建迷宫
v1.0.0
2020-11-08 22:27 UTC
Requires
- php: >=8.0
Requires (Dev)
- ext-mbstring: *
- phpunit/phpunit: ^9.4
This package is not auto-updated.
Last update: 2024-09-09 16:32:28 UTC
README
使用 ascii 艺术创建迷宫。
用法
使用 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
贡献
- 如果您喜欢这个项目,请在 GitLab 上 star 它。
- 欢迎提交问题。
许可证
此库遵循MIT 许可证。