mirror of
https://github.com/correl/riichi.git
synced 2024-11-23 19:19:55 +00:00
Improved header type documentation
This commit is contained in:
parent
0b95361b7c
commit
4524e2227b
5 changed files with 39 additions and 0 deletions
|
@ -5,10 +5,16 @@
|
||||||
-define(HONOURS, ?DRAGONS ++ ?WINDS).
|
-define(HONOURS, ?DRAGONS ++ ?WINDS).
|
||||||
-define(TILES, ?SIMPLES ++ ?TERMINALS ++ ?HONOURS).
|
-define(TILES, ?SIMPLES ++ ?TERMINALS ++ ?HONOURS).
|
||||||
|
|
||||||
|
%% @type wind() = east | south | west | north
|
||||||
-type wind() :: east | south | west | north.
|
-type wind() :: east | south | west | north.
|
||||||
|
|
||||||
|
%% @type dragon() = green | red | white
|
||||||
-type dragon() :: green | red | white.
|
-type dragon() :: green | red | white.
|
||||||
|
|
||||||
|
%% @type tile() = {tile, Suit, Value, From}
|
||||||
|
%% Suit = pin | man | sou | wind | dragon
|
||||||
|
%% Value = integer() | wind() | dragon()
|
||||||
|
%% From = draw | wind()
|
||||||
-record(tile, {
|
-record(tile, {
|
||||||
suit :: pin | man | sou | wind | dragon,
|
suit :: pin | man | sou | wind | dragon,
|
||||||
value :: integer() | wind() | dragon(),
|
value :: integer() | wind() | dragon(),
|
||||||
|
@ -16,18 +22,30 @@
|
||||||
}).
|
}).
|
||||||
-type tile() :: #tile{}.
|
-type tile() :: #tile{}.
|
||||||
|
|
||||||
|
%% @type meld() = {meld, Type, Tiles}
|
||||||
|
%% Type = pair | chii | pon | kan
|
||||||
|
%% Tiels = [tile()]
|
||||||
-record(meld, {
|
-record(meld, {
|
||||||
type :: pair | chii | pon | kan,
|
type :: pair | chii | pon | kan,
|
||||||
tiles :: [tile()]
|
tiles :: [tile()]
|
||||||
}).
|
}).
|
||||||
-type meld() :: #meld{}.
|
-type meld() :: #meld{}.
|
||||||
|
|
||||||
|
%% @type hand() = {hand, Tiles, Melds}
|
||||||
|
%% Tiles = [tile()]
|
||||||
|
%% Melds = [meld()]
|
||||||
-record(hand, {
|
-record(hand, {
|
||||||
tiles=[] :: [tile()],
|
tiles=[] :: [tile()],
|
||||||
melds=[] :: [meld()]
|
melds=[] :: [meld()]
|
||||||
}).
|
}).
|
||||||
-type hand() :: #hand{}.
|
-type hand() :: #hand{}.
|
||||||
|
|
||||||
|
%% @type player() = {player, Name, Seat, Hand, Discards, Drawn}
|
||||||
|
%% Name = string()
|
||||||
|
%% Seat = wind()
|
||||||
|
%% Hand = hand()
|
||||||
|
%% Discards = [tile()]
|
||||||
|
%% Drawn = none | {tsumo | ron, tile()}
|
||||||
-record(player, {
|
-record(player, {
|
||||||
name :: string(),
|
name :: string(),
|
||||||
seat :: wind(),
|
seat :: wind(),
|
||||||
|
@ -37,8 +55,21 @@
|
||||||
}).
|
}).
|
||||||
-type player() :: #player{}.
|
-type player() :: #player{}.
|
||||||
|
|
||||||
|
%% @type phase() = Phase
|
||||||
|
%% Phase = draw | discard
|
||||||
-type phase() :: draw | discard.
|
-type phase() :: draw | discard.
|
||||||
|
|
||||||
|
%% @type game() = {game, Rounds, Timeout, Round, Turn, Phase, Wall, Rinshan, Dora, Uradora, Players}
|
||||||
|
%% Rounds = integer()
|
||||||
|
%% Timeout = integer() | infinity
|
||||||
|
%% Round = wind()
|
||||||
|
%% Turn = wind()
|
||||||
|
%% Phase = phase()
|
||||||
|
%% Wall = [tile()]
|
||||||
|
%% Rinshan = [tile()]
|
||||||
|
%% Dora = [tile()]
|
||||||
|
%% Uradora = [tile()]
|
||||||
|
%% Players = [player()]
|
||||||
-record(game, {
|
-record(game, {
|
||||||
rounds=2 :: integer(),
|
rounds=2 :: integer(),
|
||||||
timeout=infinity :: integer() | infinity,
|
timeout=infinity :: integer() | infinity,
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
%% @author Correl Roush <correl@gmail.com>
|
%% @author Correl Roush <correl@gmail.com>
|
||||||
%%
|
%%
|
||||||
%% @doc Riichi Mahjong library.
|
%% @doc Riichi Mahjong library.
|
||||||
|
%%
|
||||||
|
%% @headerfile "../include/riichi.hrl"
|
||||||
|
|
||||||
-module(riichi).
|
-module(riichi).
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
%% @author Correl Roush <correl@gmail.com>
|
%% @author Correl Roush <correl@gmail.com>
|
||||||
%%
|
%%
|
||||||
%% @doc Riichi Mahjong library.
|
%% @doc Riichi Mahjong library.
|
||||||
|
%%
|
||||||
|
%% @headerfile "../include/riichi.hrl"
|
||||||
|
|
||||||
-module(riichi_game).
|
-module(riichi_game).
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
%% @author Correl Roush <correl@gmail.com>
|
%% @author Correl Roush <correl@gmail.com>
|
||||||
%%
|
%%
|
||||||
%% @doc Riichi Mahjong library.
|
%% @doc Riichi Mahjong library.
|
||||||
|
%%
|
||||||
|
%% @headerfile "../include/riichi.hrl"
|
||||||
|
|
||||||
-module(riichi_hand).
|
-module(riichi_hand).
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
%% @author Correl Roush <correl@gmail.com>
|
%% @author Correl Roush <correl@gmail.com>
|
||||||
%%
|
%%
|
||||||
%% @doc Riichi Mahjong library.
|
%% @doc Riichi Mahjong library.
|
||||||
|
%%
|
||||||
|
%% @headerfile "../include/riichi.hrl"
|
||||||
|
|
||||||
-module(yaku).
|
-module(yaku).
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue