Open Ledenel opened 4 years ago
for more round than r, for example draw 4 tiles to get (4s,5s) in (3*4s,2*5s,otherwise*70) invisible, we could:
p
.Since P(1s,2s) is dependent to P(3s,4s) while r>2, Inclusion–exclusion Principle should be used to calculate precise probability.
but the time complicity increased to O(2^n), which is not acceptable since n could up to 100.A cleaner division or some simplified method should be applyed to allow computation.
MultiNomial equally estimation can also be adjusted by analysis other's player hand based on discarded tiles.
consider that pick away tiles influence the remain tiles, we could directly use combinitions to calculate classical probability, then directly use Gamma function to get a general result for real-numbers remain tile estimation (adjust distribution by other's player hand by directly add tile expection to invisible tile)
we could divide it by define "useful-tiles" (u1,u2,u3,..un), "otherwise" to get a clean division. then enumerate on u by restrition sum(ui) <= r and each ui <= invisible-ui
Another idea is making this a 0-1 Knapsack Problem (counting combinitions) by mapping volumn to remain tiles to choose, mapping tiles to weights-values, add restriction below:
mactch at least a useful set lead to win (i.e. '4s5s1z' in 6s123m456789p1z7z)
this could be achieved by some common sequence dynamic programming, or something like AC-machine to represent state like
f(picking-tile, remain-volumn, useful-set-maching-state)
then apply something like O(n^3) dynamic-programming algorithms (which is acceptable since n<=136, the total tiles in mahjong) to find the answer.
Since here we could get all possible combination for win:
https://github.com/Ledenel/auto-white-reimu/blob/90f002077fcf0137ca66b45d80b77fb884450606/mahjong/container/pattern/reasoning.py#L169
assume each invisible tile is equal probability, we could leverage multinomial distribution for given a possible combination with r tiles in the invisible set:
like wikipedia explained, we could directly get all possible combinition probability just simply sum the pmf of each combination here.