一人麻雀の和了確率を計算するツール.
- シャンテン数・有効牌・不要牌同時計算アルゴリズムと, 途中の計算結果のキャッシュにより高速な計算が可能.
- 6 シャンテン(一般手, 七対子, 国士無双を含む)までのすべての手の和了確率を計算することが可能.
以下の環境で測定した(ただし計算の準備にかかる時間は含まない).
CPU: Intel® Core™ i7-10510U
メモリ: 16 GB
シャンテン数 | 計算時間(目安) |
---|---|
0 | 1 ms 以下 |
1 | 1 ms 以下 |
2 | 1 ms 以下 |
3 | 1 - 10 ms |
4 | 10 - 100 ms |
5 | 100 - 1000 ms |
6 | 1 - 20 s |
- 手替わりを考慮しない(
main
). - シャンテン戻しを考慮しない(
main
). - 各牌の枚数は 4 枚(手にある分 + 山にある分 + 河にある分 = 4).
- ツモの回数は 18 回(配牌で 1 巡消費).
手替わりとシャンテン戻しを考慮したプログラムを追加(main2).
git clone --recursive https://github.com/tomohxx/mahjong-win-prob.git
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make
和了確率を計算したい手牌を標準入力から mpsz 形式で入力する. 実行すると各打牌の各巡目での和了確率が表示される.
main
ではなくmain2
を実行して手替わり回数を入力すると手替わりとシャンテン戻しを考慮する.
$ echo 234578m1689p357s1z | ./main
Enter 14 tiles
The shanten number is 3
=== Params ===
t_min: 0
t_max: 18
t_curr: 1
sum: 123
=== Result ===
Turn 2m 5m 8m 1p 6p 9p 3s 7s 1z
1 0.1387 0.1387 0.0879 0.1511 0.1432 0.1432 0.1114 0.1114 0.1511
2 0.1208 0.1208 0.0754 0.1326 0.1252 0.1252 0.0966 0.0966 0.1326
3 0.1035 0.1035 0.0637 0.1146 0.1077 0.1077 0.0824 0.0824 0.1146
4 0.0870 0.0870 0.0527 0.0973 0.0910 0.0910 0.0689 0.0689 0.0973
5 0.0715 0.0715 0.0426 0.0808 0.0752 0.0752 0.0564 0.0564 0.0808
6 0.0572 0.0572 0.0335 0.0654 0.0605 0.0605 0.0449 0.0449 0.0654
7 0.0442 0.0442 0.0255 0.0512 0.0471 0.0471 0.0346 0.0346 0.0512
8 0.0328 0.0328 0.0186 0.0385 0.0351 0.0351 0.0255 0.0255 0.0385
9 0.0230 0.0230 0.0128 0.0274 0.0249 0.0249 0.0178 0.0178 0.0274
10 0.0150 0.0150 0.0082 0.0182 0.0164 0.0164 0.0116 0.0116 0.0182
11 0.0089 0.0089 0.0047 0.0110 0.0098 0.0098 0.0068 0.0068 0.0110
12 0.0045 0.0045 0.0024 0.0057 0.0050 0.0050 0.0035 0.0035 0.0057
13 0.0018 0.0018 0.0009 0.0023 0.0020 0.0020 0.0014 0.0014 0.0023
14 0.0004 0.0004 0.0002 0.0006 0.0005 0.0005 0.0003 0.0003 0.0006
15 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
16 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
17 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
18 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
==== Info ====
Time (msec.): 7
Searched: 3330
GNU General Public License v3.0.