Skip to content

Commit

Permalink
update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jsc723 committed Apr 19, 2023
1 parent 55a53ba commit 2fd6f5d
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 132 deletions.
210 changes: 96 additions & 114 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,35 @@ deck:配置牌组
attribute: 一个列表,定义赋予该卡的属性(标签)
属性内容自定义,例如怪兽卡、魔法卡,本家卡、泛用卡、手坑等等,均用字符串表示
注意卡牌总数不要超过之前定义的size
classes: 定义卡片的类型,每个class是一个类型,格式为
类型名: 条件1 条件2 条件3 ...
每个条件之间是逻辑与(&&)关系
每个条件的格式必须是以下一种:
conditions: 给条件或条件的组合起别名,格式为
条件名: <条件列表>
<条件列表>的格式为`<condition1> <condition2>...`,中间用空格隔开
每个condition之间是逻辑与(&&)关系
每个condition的格式必须是以下一种:
1. 牌组(deck)中定义的卡牌名
2. 定义在当前class之前的类型名 (例如class1已经定义,当前在定义class2,则定义class2时可以引用class1)
3. a:属性 -> 要求该类型包含某种特定的属性
4. A:属性(模糊匹配) -> 要求该类型包含某种特定的属性,后面的表达式可以带*(匹配任意个任意字符)或?(匹配一个任意字符
5. !条件 -> 逻辑取反(要求后面跟的条件为假)
2. a:属性 -> 要求该类型包含某种特定的属性
3. A:属性(模糊匹配) -> 要求该类型包含某种特定的属性,后面的表达式可以带*(匹配任意个任意字符)或?(匹配一个任意字符)
4. !条件 -> 逻辑取反(要求后面跟的条件为假
5. 定义在此项之前的条件名
simulate: 模拟器配置
count:模拟次数
start_card: 初始手牌为多少张卡(默认5)
turns: 模拟多少回合 (默认5)
tests:列举想要关注的主题(例:展开、阻抗),每个主题之间互不相干
主题名: 列举当前主题希望得到的手牌组合,每个组合之间是逻辑与(||)关系
组合名: 定义一种希望满足的条件,列举需要的手牌
- 手牌类型1 (引用deck定义的卡牌名或classes定义的类型名)
...
(注:当一张卡牌匹配了一种手牌类型之后,这张卡牌不会被用于匹配其他手牌类型,列举在前的手牌类型具有更高的优先级)
score: 该组合的分数(比如有多少个阻抗,默认1.0)
conditions:
- condition1 (conditions定义的条件名,或者<条件列表>)
- condition2
...
(注:当一张卡牌匹配了一种手牌类型之后,这张卡牌不会被用于匹配其他手牌类型,列举在前的手牌类型具有更高的优先级)
```
注:文档里请只写半角字符(不要写中文不然可能出错)
####
```yaml

deck:
deck:
size: 40
cards:
Expand Down Expand Up @@ -80,8 +85,6 @@ deck:
dhero-fusion:
count: 2
attribute: ['H1', 'dhero']
w-patoro:
attribute: ['W', 'witches']
urara:
count: 2
attribute: ['M', 'handtrap']
Expand All @@ -90,44 +93,49 @@ deck:
attribute: ['M', 'huai-shou']
others:
count: -1
classes:
conditions:
Witches: A:w*ch?s
Witches-Monster: Witches a:M
Witches-Low-Monster: Witches a:M a:low
Witches-High-Monster: Witches-Monster !a:low
Witches-Magic: Witches A:H?
Witches-Search: w-creation
Witches-Start: a:start
Field: sato
DHERO-Fusion: dhero-fusion
Hand-Trap: a:handtrap
simulate:
count: 50000
count: 1000
start_card: 5
turns: 6
tests:
Expand:
witches1:
- Witches-Start
- Witches-Magic
score: 1.0
conditions:
- a:start
- Witches-Magic
witches2:
- Witches-High-Monster
- w-demo
- Witches-Magic
conditions:
- Witches-High-Monster
- w-demo
- Witches-Magic
dhero:
- DHERO-Fusion
score: 2.0
conditions:
- dhero-fusion
Field:
field:
- Field
conditions:
- sato
Resist:
hand-trap:
- Hand-Trap
conditions:
- a:handtrap
huai-shou:
- huai-shou
conditions:
- huai-shou


```
`deck`中,我定义了一个40卡魔女术牌组,从上至下依次是魔女术本家的7种怪,7种本家魔法卡,魔法族之村(sato),
融合命运,灰流,坏兽,其他卡
融合命运,灰流丽,坏兽,其他卡

我把所有怪兽都赋予`M`标签,所有魔法卡按照类型分别赋予`H1` `H2` `H0` `Hf`(通常,速攻,永继,场地)
魔女术本家卡片赋予`witches`标签
Expand Down Expand Up @@ -155,11 +163,11 @@ Witches-High-Monster: Witches-Monster !a:low

其中展开又分为本家的两种展开和凤凰人展开,场地卡只有魔法族之村,阻抗又分成手坑和坏兽(暂且归为阻抗)每一中主题里,希望得到什么样的组合,就直接列举出来:

本家第一种展开(witches1),我希望手上有一张本家初动(Witches-Start:下级怪或检索魔法卡),并且还有另一张任意本家魔法卡(Witches-Magic),其他手牌任意
本家第一种展开(witches1),我希望手上有一张本家初动(a:start:下级怪或检索魔法卡),并且还有另一张任意本家魔法卡(Witches-Magic),其他手牌任意(这种展开我给的分数是1分)

本家第二种展开(witches2),我希望手上有一张本家高级怪,一张演示(出高级怪),和另一张任意本家魔法卡
本家第二种展开(witches2),我希望手上有一张本家高级怪,一张演示(出高级怪),和另一张任意本家魔法卡(这种展开我给的分数也是1分)

第三种展开(dhero),只要我手上有融合命运就行(DHERO-Fusion)
第三种展开(dhero),只要我手上有融合命运就行(DHERO-Fusion),这种展开的给的分数是2分

程序的输出中,对于每一个主题,每一个回合,都会显示每个主题成功的概率,以及每种组合单独的概率
(输出样例在下面)
Expand All @@ -178,93 +186,67 @@ ygo-calc.exe
## 程序输出样例
```
$ ./ygo-calc.exe example.yml
size: 40
cards:
name: w-red, count: 3, attribute: [M low start witches ]
name: w-yellow, count: 2, attribute: [M low start witches ]
name: w-grey, count: 2, attribute: [M low start witches ]
name: w-green, count: 1, attribute: [M low start witches ]
name: w-blue, count: 2, attribute: [M witches ]
name: w-black, count: 2, attribute: [M witches ]
name: w-white, count: 1, attribute: [M witches ]
name: w-creation, count: 3, attribute: [H1 start witches ]
name: w-sabo, count: 2, attribute: [H1 witches ]
name: w-colab, count: 1, attribute: [H1 witches ]
name: w-demo, count: 2, attribute: [H2 witches ]
name: w-wind, count: 1, attribute: [H2 witches ]
name: w-street, count: 1, attribute: [H0 witches ]
name: w-scroll, count: 1, attribute: [H0 witches ]
name: sato, count: 4, attribute: [Hf ]
name: dhero-fusion, count: 2, attribute: [H1 dhero ]
name: urara, count: 2, attribute: [M handtrap ]
name: huai-shou, count: 1, attribute: [M huai-shou ]
name: others, count: 7
w-creation: name==w-creation
Hand-Trap: attr=handtrap
Witches-High-Monster: attr~w*ch?s && attr=M && !attr=low
w-red: name==w-red
w-green: name==w-green
w-black: name==w-black
w-yellow: name==w-yellow
w-demo: name==w-demo
w-white: name==w-white
w-grey: name==w-grey
w-blue: name==w-blue
w-sabo: name==w-sabo
w-colab: name==w-colab
w-wind: name==w-wind
w-street: name==w-street
w-scroll: name==w-scroll
sato: name==sato
DHERO-Fusion: name==dhero-fusion
dhero-fusion: name==dhero-fusion
urara: name==urara
huai-shou: name==huai-shou
others: name==others
Witches: attr~w*ch?s
Witches-Monster: attr~w*ch?s && attr=M
Witches-Low-Monster: attr~w*ch?s && attr=M && attr=low
Witches-Magic: attr~w*ch?s && attr~H?
Witches-Search: name==w-creation
Witches-Start: attr=start
Field: name==sato
Expand: witches1: Witches-Start Witches-Magic
witches2: Witches-High-Monster w-demo Witches-Magic
dhero: DHERO-Fusion
Field: field: Field
Resist: hand-trap: Hand-Trap
huai-shou: huai-shou
Simulate 50000 times...
Time used: 2329ms
Simulate 1000 times...
Time used: 91ms
Topic: Expand
Turn 1 total: 74.25% witches1: 60.59% witches2: 6.49% dhero: 23.54%
Turn 2 total: 83.54% witches1: 71.60% witches2: 10.81% dhero: 27.88%
Turn 3 total: 90.04% witches1: 80.17% witches2: 15.69% dhero: 32.15%
Turn 4 total: 93.95% witches1: 86.49% witches2: 20.84% dhero: 36.16%
Turn 5 total: 96.51% witches1: 91.03% witches2: 26.15% dhero: 40.15%
Turn 6 total: 98.03% witches1: 94.10% witches2: 31.48% dhero: 44.03%
Turn 1 average success rate: 76.00% average score: 0.99
witches1: 62.10% witches2: 6.20% dhero: 23.10%
Turn 2 average success rate: 84.70% average score: 1.11
witches1: 72.20% witches2: 10.50% dhero: 26.20%
Turn 3 average success rate: 90.60% average score: 1.22
witches1: 80.80% witches2: 15.40% dhero: 31.20%
Turn 4 average success rate: 95.00% average score: 1.29
witches1: 88.60% witches2: 20.90% dhero: 34.50%
Turn 5 average success rate: 97.10% average score: 1.35
witches1: 92.10% witches2: 25.50% dhero: 38.10%
Turn 6 average success rate: 98.40% average score: 1.41
witches1: 94.90% witches2: 30.70% dhero: 42.40%
Topic: Field
Turn 1 total: 42.98% field: 42.98%
Turn 2 total: 49.54% field: 49.54%
Turn 3 total: 55.28% field: 55.28%
Turn 4 total: 60.84% field: 60.84%
Turn 5 total: 65.68% field: 65.68%
Turn 6 total: 70.06% field: 70.06%
Turn 1 average success rate: 39.70% average score: 0.40
field: 39.70%
Turn 2 average success rate: 45.90% average score: 0.46
field: 45.90%
Turn 3 average success rate: 51.90% average score: 0.52
field: 51.90%
Turn 4 average success rate: 57.30% average score: 0.57
field: 57.30%
Turn 5 average success rate: 62.60% average score: 0.63
field: 62.60%
Turn 6 average success rate: 67.50% average score: 0.68
field: 67.50%
Topic: Resist
Turn 1 total: 33.83% hand-trap: 23.63% huai-shou: 12.56%
Turn 2 total: 39.47% hand-trap: 27.99% huai-shou: 15.06%
Turn 3 total: 44.80% hand-trap: 32.22% huai-shou: 17.52%
Turn 4 total: 49.58% hand-trap: 36.13% huai-shou: 19.94%
Turn 5 total: 54.30% hand-trap: 40.11% huai-shou: 22.43%
Turn 6 total: 58.76% hand-trap: 44.03% huai-shou: 24.94%
Turn 1 average success rate: 33.70% average score: 0.34
hand-trap: 24.20% huai-shou: 12.30%
Turn 2 average success rate: 38.70% average score: 0.39
hand-trap: 27.90% huai-shou: 14.50%
Turn 3 average success rate: 43.30% average score: 0.43
hand-trap: 31.80% huai-shou: 16.10%
Turn 4 average success rate: 48.60% average score: 0.49
hand-trap: 36.10% huai-shou: 18.40%
Turn 5 average success rate: 53.00% average score: 0.53
hand-trap: 39.40% huai-shou: 21.10%
Turn 6 average success rate: 57.60% average score: 0.58
hand-trap: 43.40% huai-shou: 23.40%
```

Expand Down
4 changes: 2 additions & 2 deletions test/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ deck:
attribute: ['M', 'huai-shou']
others:
count: -1
classes:
conditions:
Witches: A:w*ch?s
Witches-Monster: Witches a:M
Witches-Low-Monster: Witches a:M a:low
Expand All @@ -76,7 +76,7 @@ simulate:
- w-demo
- Witches-Magic
dhero:
score: 1.5
score: 2.0
conditions:
- dhero-fusion
Field:
Expand Down
Loading

0 comments on commit 2fd6f5d

Please sign in to comment.