From 92e44606dc58e911041b9f3f31babbbc3bbc395c Mon Sep 17 00:00:00 2001 From: Correl Roush Date: Wed, 1 Aug 2012 00:11:36 -0400 Subject: [PATCH] Improved header type documentation --- include/riichi.hrl | 31 +++++++++++++++++++++++++++++++ src/riichi.erl | 2 ++ src/riichi_game.erl | 2 ++ src/riichi_hand.erl | 2 ++ src/yaku.erl | 2 ++ 5 files changed, 39 insertions(+) diff --git a/include/riichi.hrl b/include/riichi.hrl index dfdb409..bb5e84d 100644 --- a/include/riichi.hrl +++ b/include/riichi.hrl @@ -5,10 +5,16 @@ -define(HONOURS, ?DRAGONS ++ ?WINDS). -define(TILES, ?SIMPLES ++ ?TERMINALS ++ ?HONOURS). +%% @type wind() = east | south | west | north -type wind() :: east | south | west | north. +%% @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, { suit :: pin | man | sou | wind | dragon, value :: integer() | wind() | dragon(), @@ -16,18 +22,30 @@ }). -type tile() :: #tile{}. +%% @type meld() = {meld, Type, Tiles} +%% Type = pair | chii | pon | kan +%% Tiels = [tile()] -record(meld, { type :: pair | chii | pon | kan, tiles :: [tile()] }). -type meld() :: #meld{}. +%% @type hand() = {hand, Tiles, Melds} +%% Tiles = [tile()] +%% Melds = [meld()] -record(hand, { tiles=[] :: [tile()], melds=[] :: [meld()] }). -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, { name :: string(), seat :: wind(), @@ -37,8 +55,21 @@ }). -type player() :: #player{}. +%% @type phase() = Phase +%% 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, { rounds=2 :: integer(), timeout=infinity :: integer() | infinity, diff --git a/src/riichi.erl b/src/riichi.erl index bdc3961..26f5b4c 100644 --- a/src/riichi.erl +++ b/src/riichi.erl @@ -1,6 +1,8 @@ %% @author Correl Roush %% %% @doc Riichi Mahjong library. +%% +%% @headerfile "../include/riichi.hrl" -module(riichi). diff --git a/src/riichi_game.erl b/src/riichi_game.erl index 7e4f0ae..cdc706e 100644 --- a/src/riichi_game.erl +++ b/src/riichi_game.erl @@ -1,6 +1,8 @@ %% @author Correl Roush %% %% @doc Riichi Mahjong library. +%% +%% @headerfile "../include/riichi.hrl" -module(riichi_game). diff --git a/src/riichi_hand.erl b/src/riichi_hand.erl index ea70b20..092c431 100644 --- a/src/riichi_hand.erl +++ b/src/riichi_hand.erl @@ -1,6 +1,8 @@ %% @author Correl Roush %% %% @doc Riichi Mahjong library. +%% +%% @headerfile "../include/riichi.hrl" -module(riichi_hand). diff --git a/src/yaku.erl b/src/yaku.erl index 094b40a..4eb9f6c 100644 --- a/src/yaku.erl +++ b/src/yaku.erl @@ -1,6 +1,8 @@ %% @author Correl Roush %% %% @doc Riichi Mahjong library. +%% +%% @headerfile "../include/riichi.hrl" -module(yaku).