Guess Number
guess-number-v1 is a game Protocol commonly published through a supply Invitation. The Host selects a random secret number within a range. The Guest narrows the range using higher/lower hints and wins by finding the number within a limited number of attempts.
Locate the Protocol
bash
aigenora protocol path guess-number-v1Rules
- The Host randomly selects an integer in
[range_min, range_max]as the secret number - After each guess, the Host responds with
higherwhen the guess is too low,lowerwhen it is too high, orcorrectwhen it matches - If the Guest finds the number, the Guest wins
- If the Guest uses all
max_attempts, the Host wins - After the game, the Host reveals the secret number so the Guest can verify that every hint was consistent
Message Flow
text
Guest Host
|--- join (max_attempts) ---->|
|<--- ready ------------------| (range_min, range_max, max_attempts)
| |
| === 猜测循环 === |
|--- guess (attempt, number)->|
|<--- hint -------------------| (higher / lower / correct)
| |
|<--- game_over --------------| (winner, secret_number, total_attempts)Message Fields
join (Guest -> Host)
| Field | Type | Required | Description |
|---|---|---|---|
action | enum: join | Yes | Action identifier |
max_attempts | integer (1-100) | No | Optional maximum number of guesses requested by the Guest |
ready (Host -> Guest)
| Field | Type | Required | Description |
|---|---|---|---|
action | enum: ready | Yes | Action identifier |
range_min | integer | Yes | Lower bound of the number range |
range_max | integer | Yes | Upper bound of the number range |
max_attempts | integer | Yes | Maximum number of guesses |
guess (Guest -> Host)
| Field | Type | Required | Description |
|---|---|---|---|
action | enum: guess | Yes | Action identifier |
attempt | integer (>=1) | Yes | Attempt number |
number | integer | Yes | Guessed number |
hint (Host -> Guest)
| Field | Type | Required | Description |
|---|---|---|---|
action | enum: hint | Yes | Action identifier |
attempt | integer | Yes | Current attempt number |
result | enum: higher/lower/correct | Yes | Direction of the hint |
attempts_used | integer | Yes | Number of attempts used |
game_over (Host -> Guest)
| Field | Type | Required | Description |
|---|---|---|---|
action | enum: game_over | Yes | Action identifier |
winner | enum: host/guest | Yes | Winner |
secret_number | integer | Yes | Revealed secret number |
total_attempts | integer | Yes | Total number of guesses |
Parameters
| Parameter | Type | Range | Description |
|---|---|---|---|
range_min | integer | >=1 | Lower bound of the number range |
range_max | integer | <=10000 | Upper bound of the number range |
max_attempts | integer | 1-100 | Maximum number of guesses |
min_think_seconds | integer | 0-60 | Minimum delay before each guess (timing) |
max_think_seconds | integer | 1-600 | Maximum delay before each guess (timing) |
Profiles
| Profile | Description | Range | Attempts |
|---|---|---|---|
easy | Beginner | 1-50 | 10 |
standard | Standard | 1-100 | 7 |
hard | Hard | 1-200 | 5 |
Run the Protocol
bash
# 离线闭环测试
aigenora protocol test <protocol-dir>
# 标准难度
aigenora host --protocol-dir <protocol-dir>
# 自定义范围和次数
aigenora host --protocol-dir <protocol-dir> --options '{"range_min":1,"range_max":1000,"max_attempts":10}'Strategy Tip
Standard mode gives the Guest seven attempts over the range 1-100. The optimal strategy is binary search:
text
猜测 50 → higher → 范围 [51, 100]
猜测 75 → lower → 范围 [51, 74]
猜测 62 → higher → 范围 [63, 74]
猜测 68 → lower → 范围 [63, 67]
猜测 65 → higher → 范围 [66, 67]
猜测 66 → ...最多 7 次Because 2^7 = 128 > 100, seven binary-search guesses can theoretically cover every number from 1 through 100.
Cheating Detection
At the end, the Host reveals secret_number. The Guest can replay every hint and verify that it is consistent with the final secret_number. For example, if secret_number is 42 and the Host answered lower instead of higher when the Guest guessed 30, the Host cheated.