Riichi.Tile (riichi v0.2.0)

Copy Markdown View Source

Summary

Types

suit()

@type suit() :: :manzu | :pinzu | :souzu | :jihai

t()

@type t() :: %Riichi.Tile{aka?: boolean(), suit: suit(), value: value()}

value()

@type value() :: 1..9

Functions

akaize(tile)

@spec akaize(t()) :: t()

all()

@spec all() :: Enumerable.t(t())

available_in_mode?(tile, atom)

@spec available_in_mode?(t(), Riichi.Rules.mode()) :: boolean()

compare(a, b)

@spec compare(t(), t()) :: :gt | :lt | :eq

compare(a, b, ignore_aka?)

@spec compare(t(), t(), boolean()) :: :gt | :lt | :eq

deaka(tile)

@spec deaka(t()) :: t()

equal?(tile_a, tile_b, ignore_aka_flag)

@spec equal?(t(), t(), boolean()) :: boolean()

from_string(string)

@spec from_string(String.t()) :: {:ok, t()} | :error

from_string!(string)

@spec from_string!(String.t()) :: t()

indicated_tile(tile)

@spec indicated_tile(t()) :: t()

is_wind_tile(tile)

@spec is_wind_tile(t()) :: boolean()

member?(tiles, tile, ignore_aka_flag)

@spec member?([t()], t(), boolean()) :: boolean()

new(value, suit, aka?)

@spec new(value(), suit(), boolean()) :: {:ok, t()} | :error

new!(value, suit, aka?)

@spec new!(value(), suit(), boolean()) :: t()

next(tile, wrap?, step \\ 1)

@spec next(t(), boolean(), non_neg_integer()) :: {:ok, t()} | :error

next!(tile, wrap?, step \\ 1)

@spec next!(t(), boolean(), non_neg_integer()) :: t()

prev(tile, wrap?, step \\ 1)

@spec prev(t(), boolean(), non_neg_integer()) :: {:ok, t()} | :error

prev!(tile, wrap?, step \\ 1)

@spec prev!(t(), boolean(), non_neg_integer()) :: t()

sequences_for(tile)

@spec sequences_for(t()) :: [{t(), t()}]

sigil_t(string, opts)

@spec sigil_t(String.t(), list()) :: t()

simple_tile?(tile)

@spec simple_tile?(t()) :: boolean()

sort(tiles)

@spec sort([t()]) :: [t()]

suit_index(suit)

@spec suit_index(suit()) :: 1..4

suits()

@spec suits() :: [suit()]

terminal_tile?(tile)

@spec terminal_tile?(t()) :: boolean()

to_string(tile)

@spec to_string(t()) :: String.t()