ritchie/hand/scoring

Turns a winning interpretation into its yaku, han, fu, and basic points. Payments are computed separately.

Types

pub type Score {
  Score(
    yakus: List(yaku.Yaku),
    han: Int,
    fu: Int,
    yakuman: Int,
    basic_points: Int,
  )
}

Constructors

  • Score(
      yakus: List(yaku.Yaku),
      han: Int,
      fu: Int,
      yakuman: Int,
      basic_points: Int,
    )

    Arguments

    yakuman

    Number of yakuman, counting double yakuman as 2. 0 for a normal hand.

    basic_points

    Points before the dealer/ron/tsumo multipliers.

Values

pub fn best(
  inputs: List(agari.AgariInput),
  dora: Int,
  rules: rules.Ruleset,
) -> option.Option(Score)

Returns the highest-scoring interpretation, by basic points.

pub fn score(
  input: agari.AgariInput,
  dora: Int,
  rules: rules.Ruleset,
) -> option.Option(Score)

Scores a winning interpretation. dora is the number of dora han. Returns None if the hand has no yaku. Dora alone does not qualify a win.

✨ Search Document