7 个不稳定版本
0.6.3 | 2024 年 2 月 15 日 |
---|---|
0.6.2 | 2023 年 11 月 17 日 |
0.6.0 | 2022 年 6 月 10 日 |
0.5.0 | 2022 年 6 月 10 日 |
0.3.0 | 2022 年 6 月 9 日 |
#12 in #terminal-game
49 每月下载次数
21KB
358 行
prisoner
模拟 "囚犯困境" 的库。还附带一个 main.rs
用于玩耍。
为 Choice
和 Outcome
提供枚举,这些都是你真正需要来玩游戏的。公共函数 determine
会给出结果。Outcome
枚举还提供了计算分数的方法。它支持经典奖励机制(0,-1,-2,-3)奖励评分系统,以及代数返回(即 T > R > P > S
)。目前未实现 Ord
。
用法
main.rs
展示了如何使用 clap
生成 CLI。这也是 docker 容器的入口点。
prisoner 0.5.0
Ian Cullinane <ian@iancullinane.com>
A library for simulating "The Prisoner's Dilemna"
USAGE:
prisoner [OPTIONS] --players <PLAYERS>
OPTIONS:
-h, --help Print help information
-p, --players <PLAYERS>
-r, --rounds <ROUNDS>
-V, --version Print version information
依赖项
~5.5MB
~99K SLoC