MahjongRepository / mahjong

Implementation of riichi mahjong related stuff (hand cost, shanten, agari end, etc.)
MIT License
385 stars 42 forks source link

Should 26+ han kazoe yakuman considered as double yakuman? #3

Closed 0xrgb closed 7 years ago

0xrgb commented 7 years ago

There are many different rules about kazoe yakuman. Link

  1. Kazoe yakuman does not exist. Hands over 13+ han without yakuman is considered as sanbaiman.
  2. Kazoe yakuman exists, but hands over 26+ han do not counted as double yakuman.
  3. Kazoe yakuman exists, and you can consider 26+ han as double yakuman, 39+ han as triple yakuman, etc.

I don't know which rule is used by tenhou.net, but according to Wikipedia,

In most rules, a hand with 13 han or above is considered kazoe-yakuman.

so we could guess that tenhou.net uses the second rule. (If someone has tenhou.net reply link that contains 26+ han, please upload it)

In addition, this library is considering 26+ han hands as double yakuman, such as

4446667788m + 7m / (2222m closed kan) / riichi (ron) Dora and uradora indicators are [1m, 1m, 1m, 1m] riichi tanyao chiniisou sanankou toitoi dora16 (28 Han)

Nihisil commented 7 years ago

Good catch. I wasn't able to find kazoe with 26+ han in phoenix replays (max kazoe had 21 han).

I think I will add option to configure kazoe rules.

0xrgb commented 7 years ago

There are more rulesets that tenhou supports. (Lobby that starts with C can use custom ruleset) I'll list rules that related to this library (scoring).

Nihisil commented 7 years ago

Hm, I think we need to find a good way to pass all these custom rules to the calculator.

Maybe we had to pass dictionary with settings, because add additional function attributes for each case is not a good idea (it would be really big function otherwise)

This will broke compatibility, but I guess it is ok since no one use this library at current moment :)

I will come up with solution in the next a couple of days.

Nihisil commented 7 years ago

Tsumo pinfu is possible or pinfu is only for ron

Do you have any links related to this rule? I wasn't able to find it

0xrgb commented 7 years ago

From http://arcturus.su/wiki/Pinfu

As an exception, pinfu with mentsumo gains 0 fu from tsumo, or winning by self-draw. Normally, a winning tile drawn from the wall is worth 2 fu. In turn, the hand qualifies as pinfu, and these 2 fu are waived. The hand is then scored at 20 fu; and at least 2 han for menzen tsumo and pinfu. Some rule variations may not allow waiving these fu, and score such a hand as 30 fu, tsumo, without pinfu. Such variations are rare.

So, pinfu means hand without (extra) fu. Usually, tsumo gives you +2 fu except for pinfu. No-tsumo pinfu rule disallows this exception.

Nihisil commented 7 years ago

Thank you. I will add these rules variations a little bit later (kazoe config already implemented) and after that new release will be published.

Nihisil commented 7 years ago

Thanks for these suggestions. They were implemented in the new release https://github.com/MahjongRepository/mahjong/releases/tag/v1.1.2

You can find out more about these settings here: https://github.com/MahjongRepository/mahjong/blob/v1.1.2/mahjong/hand_calculating/hand_config.py#L43

And there is an example how you can change the cost of renhou (or any other yaku): https://github.com/MahjongRepository/mahjong/blob/master/doc/examples.py#L92