← Back to Skills Marketplace
lydia9781

guess-number

by Lydia9781 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
168
Downloads
0
Stars
1
Active Installs
1
Versions
Install in OpenClaw
/install guess-number
Description
Play a four-digit number guessing game where each guess receives feedback on how many digits are correct in both value and position.
README (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
Usage Guidance
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.
Capability Analysis
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.
Capability Assessment
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.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install guess-number
  3. After installation, invoke the skill by name or use /guess-number
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
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.
Metadata
Slug guess-number
Version 1.0.0
License MIT-0
All-time Installs 1
Active Installs 1
Total Versions 1
Frequently Asked Questions

What is 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. It is an AI Agent Skill for Claude Code / OpenClaw, with 168 downloads so far.

How do I install guess-number?

Run "/install guess-number" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is guess-number free?

Yes, guess-number is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does guess-number support?

guess-number is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created guess-number?

It is built and maintained by Lydia9781 (@lydia9781); the current version is v1.0.0.

💬 Comments