ritchie/engine/rules
Configurable rules and interpretations of rules for a game. The default ruleset is based on Tenhou-style 4-player public-lobby rules.
You cannot configure the number of red tiles here, see wall for that.
Similarly, you can’t configure the starting points for each player, that’s handled
in round_begin.
The Ruleset type is guaranteed not to change in patch versions. Minor versions may add
new fields, as long as the outcome of a game would not change. Only major versions can change/
remove existing fields.
Use the record update syntax to vary one rule at a time:
Ruleset(..default(), kiriage_mangan: True)
Types
pub type Ruleset {
Ruleset(
version: String,
kyoku_max_soft: Int,
kyoku_max_hard: Int,
points_min_qualify: Int,
ron_max_num_players: Int,
ron_first_only: Bool,
dora_allow_ura: Bool,
dora_allow_kan: Bool,
dora_allow_kan_ura: Bool,
kiriage_mangan: Bool,
kazoe_yakuman: Bool,
yaku_allow_double_yakuman: Bool,
yaku_allow_open_tanyao: Bool,
yaku_extra: List(yaku.Yaku),
yaku_block: List(yaku.Yaku),
extra_kokushi_allow_chankan_ankan: Bool,
extra_swap_call_allow_same: Bool,
extra_swap_call_allow_other: Bool,
extra_riichi_ankan_strict: Bool,
)
}
Constructors
-
Ruleset( version: String, kyoku_max_soft: Int, kyoku_max_hard: Int, points_min_qualify: Int, ron_max_num_players: Int, ron_first_only: Bool, dora_allow_ura: Bool, dora_allow_kan: Bool, dora_allow_kan_ura: Bool, kiriage_mangan: Bool, kazoe_yakuman: Bool, yaku_allow_double_yakuman: Bool, yaku_allow_open_tanyao: Bool, yaku_extra: List(yaku.Yaku), yaku_block: List(yaku.Yaku), extra_kokushi_allow_chankan_ankan: Bool, extra_swap_call_allow_same: Bool, extra_swap_call_allow_other: Bool, extra_riichi_ankan_strict: Bool, )Arguments
- kyoku_max_soft
-
The kyoku index for the “all-last” round. This is 3 for an east-only game, and 7 for an east-south game. The default is east-only.
- kyoku_max_hard
-
The absolute maximum amount of rounds that can be played. Any attempt to increment the kyoku number beyond this must end the game. Default is 11 (west 4 kyoku).
- points_min_qualify
-
The minimum amount of points a player needs to have for the game to end after the “all-last” round. Default is 30000, assuming 25000 starting points.
- ron_max_num_players
-
Maximum number of players that can simultaneously win by ron over the same tile. More player than allowed here would end the round on a forced abortion. Default is allowing two players.
- ron_first_only
-
Does only the first player CCW from the contributor win when multiple rons happen at the same time? Default is no.
- dora_allow_ura
-
Do we count ura-doras when a player wins under riichi? Default: yes.
- dora_allow_kan
-
Do we reveal new doras after kan? Default: yes.
- dora_allow_kan_ura
-
Do we count ura-doras for newly revealed kans? Default: yes.
- kiriage_mangan
-
A 4 han 30 fu or 3 han 60 fu hand scores mangan (2000 basic points) instead of its raw value.
- kazoe_yakuman
-
13 or more han is a counted yakuman (8000 basic points). When disabled, such hands cap at sanbaiman instead.
- yaku_allow_double_yakuman
-
Do daisuushi, suuankou tanki, kokushi 13-sided wait and junsei chuurenpoutou count as double yakuman? Default: no.
- yaku_allow_open_tanyao
-
Is Tanyao allowed in an open hand? Default is yes.
- yaku_extra
-
A list of extra, nonstandard Yaku to enable. Currently there are none, but some may be implemented in the future. Default is none.
- yaku_block
-
A list of standard Yaku to disable. Default is none.
- extra_kokushi_allow_chankan_ankan
-
Can a player who is waiting on a kokushi (thirteen orphans) call a chankan ron over an ankan (i.e. steal the ankan)? This is in addition to calling chankan on kakan, which is already allowed under all rules. The default is no.
- extra_swap_call_allow_same
-
After calling chii/pon on a certain tile, is it okay to immediately discard another copy of the same tile, where red 5s are considered the same as the normal tile? The default is no.
- extra_swap_call_allow_other
-
After calling chii on a certain tile (e.g. 45m + 6m), is it okay to immediately discard a tile that would have formed a group on the other end (e.g. 3m)? The default is no.
- extra_riichi_ankan_strict
-
Do we use the strict rules for calling ankan while under riichi? The strict rule only allows ankan from the self draw immediately before it. It must also not change the waiting pattern, and it must not destroy the chuurenpoutou form, if it exists. The relaxed rule means the ankan must not change the waiting pattern, but nothing else. The default is true.