Created
February 15, 2023 14:06
-
-
Save tomohxx/1d69f22cbb38db78547f88e22946ed0c to your computer and use it in GitHub Desktop.
七対子の聴牌確率(巡目別対子数別)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <iomanip> | |
#include <iostream> | |
int main() | |
{ | |
constexpr int T_MAX = 18; | |
constexpr int T_MIN = 1; | |
constexpr int S = 123; // 四麻 | |
// constexpr int S = 95; // 三麻 | |
std::array<std::array<double, T_MAX + 1>, 8> table = {}; | |
for (int t = T_MIN; t <= T_MAX; ++t) { | |
table[6][t] = 1.; | |
} | |
for (int i = 5; i >= 0; --i) { | |
for (int t = T_MAX - 1; t >= T_MIN; --t) { | |
table[i][t] = (1. - (39. - 6 * i) / (S - t)) * table[i][t + 1] + | |
(39. - 6 * i) / (S - t) * table[i + 1][t + 1]; | |
} | |
} | |
std::cout << std::setw(5) << std::left << "Turn"; | |
for (int i = 6; i >= 0; --i) { | |
std::cout << std::setw(12) << std::left << i; | |
} | |
std::cout << "\n"; | |
for (int t = T_MIN; t <= T_MAX; ++t) { | |
std::cout << std::setw(5) << t; | |
for (int i = 6; i >= 0; --i) { | |
std::cout << std::setw(12) << std::setprecision(4) | |
<< std::scientific << table[i][t]; | |
} | |
std::cout << "\n"; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment