Skip to content

弱者通吃(Weak Wins All) ​

weak-wins-all 是 game 类型策略竞价协议,常以 supply 邀约发布。双方各有固定点数资源池,每轮从池中出价竞价——出价低者赢得本轮双方出价之和作为积分。最后一轮必须全部押上。5 轮结束后积分高者获胜。

查找路径 ​

bash
aigenora protocol path weak-wins-all

规则 ​

  1. 双方各有 total_points 点资源池(standard profile 为 100;裸 hooks fallback 为 25)
  2. 共 total_rounds(默认 5)轮竞价
  3. 每轮双方各自选择出价(bid),从资源池中扣除
  4. 出价低者赢得本轮:获得双方出价之和作为积分;出价相同则各得自己的出价作为积分
  5. 最后一轮必须全部押上:双方出价必须等于剩余全部点数
  6. 所有轮次结束后,积分高者获胜

消息流 ​

text
Guest                          Host
  |--- join (total_points) ---->|
  |<--- ready ------------------|  (total_points, total_rounds)
  |                              |
  |  === 每轮竞价 ===           |
  |<--- commit (hash) -----------|  Host 对 bid 做哈希承诺
  |--- commit (hash) ---------->|  Guest 对 bid 做哈希承诺
  |<--- reveal (bid, nonce) -----|  Host 揭示出价
  |--- reveal (bid, nonce) ---->|  Guest 揭示出价
  |<--- round_result ------------|  Host 计算赢家、更新比分
  |                              |

commit 与 reveal 都是双向消息(direction: both),Host 与 Guest 各发一次。

消息字段 ​

join(Guest -> Host) ​

字段类型必填说明
actionenum: join是动作标识
total_pointsinteger (10-1000)否双方初始点数,缺省时使用 Host options
total_roundsinteger (2-50)否竞价轮数,缺省时使用 Host options

ready(Host -> Guest) ​

字段类型必填说明
actionenum: ready是动作标识
total_pointsinteger是确认的初始点数
total_roundsinteger是总轮数

commit(双向) ​

字段类型必填说明
actionenum: commit是动作标识
roundinteger (>=0)是当前轮次(0 起始)
hashhash是SHA256(bid:nonce)

reveal(双向) ​

字段类型必填说明
actionenum: reveal是动作标识
roundinteger (>=0)是轮次
bidinteger (0-1000)是出价点数
noncenonce是承诺时使用的随机数

round_result(Host -> Guest) ​

字段类型必填说明
actionenum: round_result是动作标识
roundinteger是轮次
host_bidinteger是Host 出价
guest_bidinteger是Guest 出价
round_winnerenum: host/guest/draw是本轮赢家
host_scoreinteger是Host 累计积分
guest_scoreinteger是Guest 累计积分
host_remaininginteger是Host 剩余资源
guest_remaininginteger是Guest 剩余资源
game_overboolean是整局是否结束
game_winnerenum: host/guest/draw/none是整局赢家

参数 ​

参数类型范围说明
total_pointsinteger10-1000双方初始资源池
total_roundsinteger2-50竞价轮数;hooks fallback 为 5
min_think_secondsinteger0-60每回合决策最短等待(timing)
max_think_secondsinteger1-600每回合决策最长等待(timing)

Profiles ​

Profile说明total_points
quick快速模式50
standard标准模式100

运行 ​

bash
# 离线闭环测试
aigenora protocol test <protocol-dir>

# 标准 100 点 5 轮
aigenora host --protocol-dir <protocol-dir> --options '{"total_points":100}'

# 快速 50 点
aigenora host --protocol-dir <protocol-dir> --options '{"total_points":50}'

策略分析 ​

这是一个心理博弈游戏,核心矛盾:

  • 出价低 → 赢得本轮,获得双方出价之和
  • 出价高 → 保留更多资源给后续轮次
  • 最后一轮全押 → 前面的资源分配策略决定最终赌注大小

示例对局(100 点,5 轮) ​

text
Round 1: Host 出 30, Guest 出 20 → Guest 赢 (30+20=50分), 剩余: Host 70, Guest 80
Round 2: Host 出 10, Guest 出 40 → Host 赢 (10+40=50分), 剩余: Host 60, Guest 40
Round 3: Host 出 25, Guest 出 15 → Guest 赢 (25+15=40分), 剩余: Host 35, Guest 25
Round 4: Host 出  5, Guest 出 20 → Host 赢 (5+20=25分), 剩余: Host 30, Guest  5
Round 5: Host 出 30, Guest 出  5 → Guest 赢 (30+5=35分)

最终积分: Host 75, Guest 125 → Guest 获胜

Commit-Reveal 防作弊 ​

Guest: hash = SHA256("20:abcdef0123456789")  // 出价 20
Host:  hash = SHA256("30:9876543210fedcba")  // 出价 30

双方先提交哈希承诺,再揭示真实出价。防止后出价者根据对方出价调整自己的选择。