nonebot-plugin-maze


Namenonebot-plugin-maze JSON
Version 0.2.4 PyPI version JSON
download
home_pagehttps://github.com/EtherLeaF/nonebot_plugin_maze
SummaryNoneBot2交互式走迷宫插件
upload_time2022-12-24 07:37:31
maintainer
docs_urlNone
authorEtherLeaF
requires_python>=3.8
license
keywords pip nonebot2 nonebot nonebot_plugin
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
  <a href="https://v2.nonebot.dev/store"><img src="https://s2.loli.net/2022/06/16/opBDE8Swad5rU3n.png" width="180" height="180" alt="NoneBotPluginLogo"></a>
  <br>
  <p><img src="https://s2.loli.net/2022/06/16/xsVUGRrkbn1ljTD.png" width="240" alt="NoneBotPluginText"></p>
</div>

<div align="center">

# Nonebot_Plugin_Maze

_✨ 基于OneBot适配器的[NoneBot2](https://v2.nonebot.dev/)交互式解迷宫插件 ✨_
  
</div>

## 功能

- 可指定大小与算法生成迷宫
- 发送方向与步数解迷宫
- 游戏过程中可随时退出

## 安装

- 使用 nb-cli

```
nb plugin install nonebot_plugin_maze
```

- 使用 pip

```
pip install nonebot_plugin_maze
```

## 获取插件帮助

- 可选择接入[nonebot-plugin-PicMenu](https://github.com/hamo-reid/nonebot_plugin_PicMenu)以便用户获取插件相关信息与用法。

## 如何使用

### .env 配置项

```ini
min_maze_rows: int = 13            # 迷宫最小行数
max_maze_rows: int = 35            # 迷宫最大行数
min_maze_cols: int = 13            # 迷宫最小列数
max_maze_cols: int = 35            # 迷宫最大列数
default_maze_rows: int = 18        # 迷宫默认生成行数
default_maze_cols: int = 27        # 迷宫默认生成列数
maze_movement_key: str = "ULDR"    # 迷宫移动方向键
```

各配置项的含义与默认值如上。
  
- 对于以上配置项,规定需同时满足```min_maze_rows <= default_maze_rows <= max_maze_rows```以及```min_maze_cols <= default_maze_cols <= max_maze_cols```。

- 因此,在修改一些配置项时可能强制需要连着某些其他的配置项一起修改。


- 同时,建议不要把最小行数/列数设置为小于10的值,以免引发未知错误

  - 也建议不要把最大行数/列数设置过大,例如50以上,第一是因为资源占用问题,~~第二是因为生成个那么大的迷宫有谁愿意玩啊喂~~


- 可遵循```上左下右```的格式修改移动方向键,例如```WASD```,规定方向键***只能为字母***。

### 开始游戏

使用以下命令触发,需加上命令前缀!

```
maze [-r --rows <ROWS>] [-c --cols <COLUMNS>] [-m --method <ALGORITHM>]
```

- 可使用```-r```规定迷宫的行数,```-c```规定迷宫的列数

    - 以上两项参数的范围和默认值参考```.env```文件中的相关配置项。

- 可使用```-m```规定迷宫的生成算法,目前支持```DFS```,```Prim```,```Kruskal```三种算法,默认值为```Kruskal```,检测此参数时对大小写不敏感。

### 如何进行游戏

~~在用户发送指令获取到初始迷宫后,我们终于可以愉快地开始游戏了!~~

用户需要持续发送***操作序列***以在迷宫中移动,直到解开迷宫。

要知道***操作序列***是什么,首先要定义***操作***。

***注:以下定义使用默认参数```maze_movement_key = "ULDR"```***

- 我们定义一个操作的格式为```方向+步数```,用正则表达就是```[UDLR]\d*```,用阳间方法表达的话就是```U(up)|D(down)|L(left)|R(right) + steps```,```步数```可以留空以表示一步。
- 例如```R```,```D3```,```L1```就是几个合法的操作,分别表示右移一步,下移三步,左移一步。

    - 为避免频繁数格子的问题,我们定义```一步```为沿该方向的路径***一直走***,直到遇见死路或走到岔路口。

***有了操作是什么,我们定义操作序列为```n(n≥1)```个操作组合而成的字符串。***

游戏中觉得太耗时间?迷宫太难解不出来?不想玩了?

- 可以在游戏过程中随时发送```结束```或者```quit```以结束游戏并获取参考解法。

## 演示

只用文字描述往往十分吃力,废话不多说,上Demo:

<div align="left">
  <img src="https://user-images.githubusercontent.com/100039483/168439968-624e4cdf-ae94-485d-9113-740a0b1993a7.png" width="500" />
</div>

<div align="left">
  <img src="https://user-images.githubusercontent.com/100039483/168439976-e31bad3b-c774-498c-8705-2d27bf87a4cb.png" width="500" />
</div>

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/EtherLeaF/nonebot_plugin_maze",
    "name": "nonebot-plugin-maze",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "pip,nonebot2,nonebot,nonebot_plugin",
    "author": "EtherLeaF",
    "author_email": "thetapilla@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/fe/73/0367436f63c738834ec1acd5ae41cc60008322a5eae6f74e8d0331f11f37/nonebot_plugin_maze-0.2.4.tar.gz",
    "platform": "any",
    "description": "<div align=\"center\">\r\n  <a href=\"https://v2.nonebot.dev/store\"><img src=\"https://s2.loli.net/2022/06/16/opBDE8Swad5rU3n.png\" width=\"180\" height=\"180\" alt=\"NoneBotPluginLogo\"></a>\r\n  <br>\r\n  <p><img src=\"https://s2.loli.net/2022/06/16/xsVUGRrkbn1ljTD.png\" width=\"240\" alt=\"NoneBotPluginText\"></p>\r\n</div>\r\n\r\n<div align=\"center\">\r\n\r\n# Nonebot_Plugin_Maze\r\n\r\n_\u2728 \u57fa\u4e8eOneBot\u9002\u914d\u5668\u7684[NoneBot2](https://v2.nonebot.dev/)\u4ea4\u4e92\u5f0f\u89e3\u8ff7\u5bab\u63d2\u4ef6 \u2728_\r\n  \r\n</div>\r\n\r\n## \u529f\u80fd\r\n\r\n- \u53ef\u6307\u5b9a\u5927\u5c0f\u4e0e\u7b97\u6cd5\u751f\u6210\u8ff7\u5bab\r\n- \u53d1\u9001\u65b9\u5411\u4e0e\u6b65\u6570\u89e3\u8ff7\u5bab\r\n- \u6e38\u620f\u8fc7\u7a0b\u4e2d\u53ef\u968f\u65f6\u9000\u51fa\r\n\r\n## \u5b89\u88c5\r\n\r\n- \u4f7f\u7528 nb-cli\r\n\r\n```\r\nnb plugin install nonebot_plugin_maze\r\n```\r\n\r\n- \u4f7f\u7528 pip\r\n\r\n```\r\npip install nonebot_plugin_maze\r\n```\r\n\r\n## \u83b7\u53d6\u63d2\u4ef6\u5e2e\u52a9\r\n\r\n- \u53ef\u9009\u62e9\u63a5\u5165[nonebot-plugin-PicMenu](https://github.com/hamo-reid/nonebot_plugin_PicMenu)\u4ee5\u4fbf\u7528\u6237\u83b7\u53d6\u63d2\u4ef6\u76f8\u5173\u4fe1\u606f\u4e0e\u7528\u6cd5\u3002\r\n\r\n## \u5982\u4f55\u4f7f\u7528\r\n\r\n### .env \u914d\u7f6e\u9879\r\n\r\n```ini\r\nmin_maze_rows: int = 13            # \u8ff7\u5bab\u6700\u5c0f\u884c\u6570\r\nmax_maze_rows: int = 35            # \u8ff7\u5bab\u6700\u5927\u884c\u6570\r\nmin_maze_cols: int = 13            # \u8ff7\u5bab\u6700\u5c0f\u5217\u6570\r\nmax_maze_cols: int = 35            # \u8ff7\u5bab\u6700\u5927\u5217\u6570\r\ndefault_maze_rows: int = 18        # \u8ff7\u5bab\u9ed8\u8ba4\u751f\u6210\u884c\u6570\r\ndefault_maze_cols: int = 27        # \u8ff7\u5bab\u9ed8\u8ba4\u751f\u6210\u5217\u6570\r\nmaze_movement_key: str = \"ULDR\"    # \u8ff7\u5bab\u79fb\u52a8\u65b9\u5411\u952e\r\n```\r\n\r\n\u5404\u914d\u7f6e\u9879\u7684\u542b\u4e49\u4e0e\u9ed8\u8ba4\u503c\u5982\u4e0a\u3002\r\n  \r\n- \u5bf9\u4e8e\u4ee5\u4e0a\u914d\u7f6e\u9879\uff0c\u89c4\u5b9a\u9700\u540c\u65f6\u6ee1\u8db3```min_maze_rows <= default_maze_rows <= max_maze_rows```\u4ee5\u53ca```min_maze_cols <= default_maze_cols <= max_maze_cols```\u3002\r\n\r\n- \u56e0\u6b64\uff0c\u5728\u4fee\u6539\u4e00\u4e9b\u914d\u7f6e\u9879\u65f6\u53ef\u80fd\u5f3a\u5236\u9700\u8981\u8fde\u7740\u67d0\u4e9b\u5176\u4ed6\u7684\u914d\u7f6e\u9879\u4e00\u8d77\u4fee\u6539\u3002\r\n\r\n\r\n- \u540c\u65f6\uff0c\u5efa\u8bae\u4e0d\u8981\u628a\u6700\u5c0f\u884c\u6570/\u5217\u6570\u8bbe\u7f6e\u4e3a\u5c0f\u4e8e10\u7684\u503c\uff0c\u4ee5\u514d\u5f15\u53d1\u672a\u77e5\u9519\u8bef\r\n\r\n  - \u4e5f\u5efa\u8bae\u4e0d\u8981\u628a\u6700\u5927\u884c\u6570/\u5217\u6570\u8bbe\u7f6e\u8fc7\u5927\uff0c\u4f8b\u598250\u4ee5\u4e0a\uff0c\u7b2c\u4e00\u662f\u56e0\u4e3a\u8d44\u6e90\u5360\u7528\u95ee\u9898\uff0c~~\u7b2c\u4e8c\u662f\u56e0\u4e3a\u751f\u6210\u4e2a\u90a3\u4e48\u5927\u7684\u8ff7\u5bab\u6709\u8c01\u613f\u610f\u73a9\u554a\u5582~~\r\n\r\n\r\n- \u53ef\u9075\u5faa```\u4e0a\u5de6\u4e0b\u53f3```\u7684\u683c\u5f0f\u4fee\u6539\u79fb\u52a8\u65b9\u5411\u952e\uff0c\u4f8b\u5982```WASD```\uff0c\u89c4\u5b9a\u65b9\u5411\u952e***\u53ea\u80fd\u4e3a\u5b57\u6bcd***\u3002\r\n\r\n### \u5f00\u59cb\u6e38\u620f\r\n\r\n\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u89e6\u53d1\uff0c\u9700\u52a0\u4e0a\u547d\u4ee4\u524d\u7f00\uff01\r\n\r\n```\r\nmaze [-r --rows <ROWS>] [-c --cols <COLUMNS>] [-m --method <ALGORITHM>]\r\n```\r\n\r\n- \u53ef\u4f7f\u7528```-r```\u89c4\u5b9a\u8ff7\u5bab\u7684\u884c\u6570\uff0c```-c```\u89c4\u5b9a\u8ff7\u5bab\u7684\u5217\u6570\r\n\r\n    - \u4ee5\u4e0a\u4e24\u9879\u53c2\u6570\u7684\u8303\u56f4\u548c\u9ed8\u8ba4\u503c\u53c2\u8003```.env```\u6587\u4ef6\u4e2d\u7684\u76f8\u5173\u914d\u7f6e\u9879\u3002\r\n\r\n- \u53ef\u4f7f\u7528```-m```\u89c4\u5b9a\u8ff7\u5bab\u7684\u751f\u6210\u7b97\u6cd5\uff0c\u76ee\u524d\u652f\u6301```DFS```\uff0c```Prim```\uff0c```Kruskal```\u4e09\u79cd\u7b97\u6cd5\uff0c\u9ed8\u8ba4\u503c\u4e3a```Kruskal```\uff0c\u68c0\u6d4b\u6b64\u53c2\u6570\u65f6\u5bf9\u5927\u5c0f\u5199\u4e0d\u654f\u611f\u3002\r\n\r\n### \u5982\u4f55\u8fdb\u884c\u6e38\u620f\r\n\r\n~~\u5728\u7528\u6237\u53d1\u9001\u6307\u4ee4\u83b7\u53d6\u5230\u521d\u59cb\u8ff7\u5bab\u540e\uff0c\u6211\u4eec\u7ec8\u4e8e\u53ef\u4ee5\u6109\u5feb\u5730\u5f00\u59cb\u6e38\u620f\u4e86\uff01~~\r\n\r\n\u7528\u6237\u9700\u8981\u6301\u7eed\u53d1\u9001***\u64cd\u4f5c\u5e8f\u5217***\u4ee5\u5728\u8ff7\u5bab\u4e2d\u79fb\u52a8\uff0c\u76f4\u5230\u89e3\u5f00\u8ff7\u5bab\u3002\r\n\r\n\u8981\u77e5\u9053***\u64cd\u4f5c\u5e8f\u5217***\u662f\u4ec0\u4e48\uff0c\u9996\u5148\u8981\u5b9a\u4e49***\u64cd\u4f5c***\u3002\r\n\r\n***\u6ce8\uff1a\u4ee5\u4e0b\u5b9a\u4e49\u4f7f\u7528\u9ed8\u8ba4\u53c2\u6570```maze_movement_key = \"ULDR\"```***\r\n\r\n- \u6211\u4eec\u5b9a\u4e49\u4e00\u4e2a\u64cd\u4f5c\u7684\u683c\u5f0f\u4e3a```\u65b9\u5411+\u6b65\u6570```\uff0c\u7528\u6b63\u5219\u8868\u8fbe\u5c31\u662f```[UDLR]\\d*```\uff0c\u7528\u9633\u95f4\u65b9\u6cd5\u8868\u8fbe\u7684\u8bdd\u5c31\u662f```U(up)|D(down)|L(left)|R(right) + steps```\uff0c```\u6b65\u6570```\u53ef\u4ee5\u7559\u7a7a\u4ee5\u8868\u793a\u4e00\u6b65\u3002\r\n- \u4f8b\u5982```R```\uff0c```D3```\uff0c```L1```\u5c31\u662f\u51e0\u4e2a\u5408\u6cd5\u7684\u64cd\u4f5c\uff0c\u5206\u522b\u8868\u793a\u53f3\u79fb\u4e00\u6b65\uff0c\u4e0b\u79fb\u4e09\u6b65\uff0c\u5de6\u79fb\u4e00\u6b65\u3002\r\n\r\n    - \u4e3a\u907f\u514d\u9891\u7e41\u6570\u683c\u5b50\u7684\u95ee\u9898\uff0c\u6211\u4eec\u5b9a\u4e49```\u4e00\u6b65```\u4e3a\u6cbf\u8be5\u65b9\u5411\u7684\u8def\u5f84***\u4e00\u76f4\u8d70***\uff0c\u76f4\u5230\u9047\u89c1\u6b7b\u8def\u6216\u8d70\u5230\u5c94\u8def\u53e3\u3002\r\n\r\n***\u6709\u4e86\u64cd\u4f5c\u662f\u4ec0\u4e48\uff0c\u6211\u4eec\u5b9a\u4e49\u64cd\u4f5c\u5e8f\u5217\u4e3a```n(n\u22651)```\u4e2a\u64cd\u4f5c\u7ec4\u5408\u800c\u6210\u7684\u5b57\u7b26\u4e32\u3002***\r\n\r\n\u6e38\u620f\u4e2d\u89c9\u5f97\u592a\u8017\u65f6\u95f4\uff1f\u8ff7\u5bab\u592a\u96be\u89e3\u4e0d\u51fa\u6765\uff1f\u4e0d\u60f3\u73a9\u4e86\uff1f\r\n\r\n- \u53ef\u4ee5\u5728\u6e38\u620f\u8fc7\u7a0b\u4e2d\u968f\u65f6\u53d1\u9001```\u7ed3\u675f```\u6216\u8005```quit```\u4ee5\u7ed3\u675f\u6e38\u620f\u5e76\u83b7\u53d6\u53c2\u8003\u89e3\u6cd5\u3002\r\n\r\n## \u6f14\u793a\r\n\r\n\u53ea\u7528\u6587\u5b57\u63cf\u8ff0\u5f80\u5f80\u5341\u5206\u5403\u529b\uff0c\u5e9f\u8bdd\u4e0d\u591a\u8bf4\uff0c\u4e0aDemo\uff1a\r\n\r\n<div align=\"left\">\r\n  <img src=\"https://user-images.githubusercontent.com/100039483/168439968-624e4cdf-ae94-485d-9113-740a0b1993a7.png\" width=\"500\" />\r\n</div>\r\n\r\n<div align=\"left\">\r\n  <img src=\"https://user-images.githubusercontent.com/100039483/168439976-e31bad3b-c774-498c-8705-2d27bf87a4cb.png\" width=\"500\" />\r\n</div>\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "NoneBot2\u4ea4\u4e92\u5f0f\u8d70\u8ff7\u5bab\u63d2\u4ef6",
    "version": "0.2.4",
    "split_keywords": [
        "pip",
        "nonebot2",
        "nonebot",
        "nonebot_plugin"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "372b8294e3fdf2c5c72bf32f35965795",
                "sha256": "eb858b847c35e6a160446138dae99f3ca68872432ae7cab3e7db52188886b5a9"
            },
            "downloads": -1,
            "filename": "nonebot_plugin_maze-0.2.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "372b8294e3fdf2c5c72bf32f35965795",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 12285,
            "upload_time": "2022-12-24T07:37:30",
            "upload_time_iso_8601": "2022-12-24T07:37:30.144772Z",
            "url": "https://files.pythonhosted.org/packages/79/77/dcf8ac79a8c4b396f3324e6fe0fe22ebd1d5baa8d166e22131bba91d3ada/nonebot_plugin_maze-0.2.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "90ab81fc2b7977a4555eaedd81089de9",
                "sha256": "4e3447d0893bad8ea42d24949ff01a1bffc41b19fe4c01db70ef7ee23a39a3f7"
            },
            "downloads": -1,
            "filename": "nonebot_plugin_maze-0.2.4.tar.gz",
            "has_sig": false,
            "md5_digest": "90ab81fc2b7977a4555eaedd81089de9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 12821,
            "upload_time": "2022-12-24T07:37:31",
            "upload_time_iso_8601": "2022-12-24T07:37:31.834423Z",
            "url": "https://files.pythonhosted.org/packages/fe/73/0367436f63c738834ec1acd5ae41cc60008322a5eae6f74e8d0331f11f37/nonebot_plugin_maze-0.2.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-24 07:37:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "EtherLeaF",
    "github_project": "nonebot_plugin_maze",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "nonebot-plugin-maze"
}
        
Elapsed time: 0.30037s