← 返回 Skills 市场
lydia9781

guess-number

作者 Lydia9781 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
168
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install guess-number
功能描述
Play a four-digit number guessing game where each guess receives feedback on how many digits are correct in both value and position.
使用说明 (SKILL.md)
---\r
name: guess-number\r
description: 猜四位数数字推理游戏。当用户提到玩猜数字游戏、猜四位数、数字推理游戏时使用本技能。系统生成一个各位不重复的四位数,用户通过多次猜测推理出正确数字,每次猜测后反馈位置正确的数字个数。\r
---\r
\r
# 猜四位数游戏技能\r
\r
## 技能概述\r
本技能实现经典的四位数数字推理游戏,用户需要通过有限次数的猜测,推理出系统随机生成的四位数(各位数字互不重复)。每次猜测后系统仅反馈位置和数字均正确的位数,帮助用户逐步缩小范围,最终猜中答案。\r
\r
## 触发场景\r
当用户输入以下内容时触发本技能:\r
- "玩猜数字游戏"\r
- "猜四位数"\r
- "数字推理游戏"\r
- "来玩个猜数字游戏"\r
- 其他类似表达想要玩猜数字游戏的请求\r
\r
## 使用方法\r
游戏拆分为两个独立阶段:\r
\r
### 阶段1:开始新游戏\r
当用户说「开始游戏」「新局」「玩猜数字游戏」时,运行生成命令创建新局:\r
```bash\r
python scripts/guess_number.py --generate\r
```\r
该命令会随机生成4位不重复的秘密数字,写入到脚本目录下的`secret.txt`文件中,并初始化步数计数器。\r
\r
### 阶段2:验证用户猜测\r
当用户输入4位数字进行猜测时,运行验证命令返回结果:\r
```bash\r
python scripts/guess_number.py --verify \x3C用户输入的4位数字>\r
```\r
该命令会从`secret.txt`读取秘密数字,与用户猜测的数字对比,返回位置正确的数字个数。\r
- 若用户猜对,自动删除`secret.txt`和步数文件,游戏结束\r
- 若游戏未开始(`secret.txt`不存在),提示用户先开始游戏\r
- 非法输入给出对应错误提示,不消耗步数\r
\r
## 游戏规则\r
1. 系统随机生成一个4位数字,各位数字互不重复(允许0开头,例如0123是合法数字)\r
2. 用户每次输入一个4位数字,需满足各位不重复、仅包含数字0-9\r
3. 系统比较用户猜测与秘密数字,返回位置和数字均正确的个数k(0 ≤ k ≤ 4)\r
4. 当k=4时,用户猜中,游戏结束,显示总猜测次数\r
5. 输入校验规则:\r
   - 非4位数字:提示"请输入4位数字,请重新输入"\r
   - 包含非数字字符:提示"只能输入数字,请重新输入"\r
   - 数字有重复:提示"数字不能重复,请重新输入"\r
\r
## 交互示例\r
```\r
系统:我已想好一个四位数(各位数字互不相同),请开始猜测!\r
用户:1234\r
系统:反馈:2 个数字位置正确\r
用户:5678\r
系统:反馈:0 个数字位置正确\r
用户:2568\r
系统:反馈:4 个数字位置正确!恭喜你猜对了!总共用了 9 步。\r
```\r
\r
## 注意事项\r
- 生成的秘密数字必须保证完全随机且各位无重复,保存到`secret.txt`中,仅在游戏结束后自动删除\r
- 反馈结果必须准确,不得泄露任何额外信息(例如不得告知哪些数字正确,不得告知数字存在但位置错误的情况)\r
- 严格校验用户输入,避免非法输入导致游戏崩溃,非法输入不消耗猜测步数\r
- 若用户主动中断游戏,需自动清理`secret.txt`和步数文件,避免影响下一局游戏\r
- 游戏结束后主动询问用户是否需要再来一局\r
安全使用建议
This skill appears to be a straightforward local game. Before installing, ensure the environment you run it in allows writing files in the skill directory (the script creates secret.txt and step.txt) and that this is acceptable on shared systems (those files contain the game's secret while a game is active). Also ensure Python 3 is available. If you run in a multi-user environment and want stronger privacy, consider modifying the script to store secrets in a more protected location or in-memory only.
功能分析
Type: OpenClaw Skill Name: guess-number Version: 1.0.0 The skill implements a standard 4-digit number guessing game. The Python script (scripts/guess_number.py) manages game state using local text files (secret.txt and step.txt) and contains no network activity, unauthorized file access, or dangerous execution patterns. The instructions in SKILL.md are consistent with the code's functionality and do not contain any prompt-injection attacks or malicious directives.
能力评估
Purpose & Capability
The skill name/description describe a local number-guessing game and the provided Python script implements exactly that. There are no unexpected environment variables, binaries, or external services required.
Instruction Scope
SKILL.md instructs the agent to run the included script in two modes (--generate and --verify). The script only reads/writes secret.txt and step.txt in the script's directory and performs input validation and matching; it does not access other files, environment variables, or network endpoints.
Install Mechanism
There is no install spec or external download. The skill is instruction+script only. This is low-risk and proportional for a simple local game.
Credentials
The skill requires no credentials, config paths, or environment variables. The only resources used are local files (secret.txt, step.txt) created in the script directory.
Persistence & Privilege
The skill does not request persistent/global privileges, does not set always:true, and only writes/cleans up its own temporary files within the script folder. It does not modify other skills or system-wide settings.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install guess-number
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /guess-number 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
- Initial release of the guess-number skill. - Enables a classic four-digit non-repeating number guessing game with feedback on correctly positioned digits. - Game is started on request and managed via Python scripts. - Validates input rigorously, only accepts legal guesses and provides clear error messages. - Cleans up files after the game ends or is interrupted. - Offers to start a new game at the end of each round.
元数据
Slug guess-number
版本 1.0.0
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 1
常见问题

guess-number 是什么?

Play a four-digit number guessing game where each guess receives feedback on how many digits are correct in both value and position. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 168 次。

如何安装 guess-number?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install guess-number」即可一键安装,无需额外配置。

guess-number 是免费的吗?

是的,guess-number 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

guess-number 支持哪些平台?

guess-number 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 guess-number?

由 Lydia9781(@lydia9781)开发并维护,当前版本 v1.0.0。

💬 留言讨论