riichi/src/hand.erl
2013-06-14 23:43:46 -04:00

12 lines
281 B
Erlang

-module(hand).
-include("riichi.hrl").
-export([discards/1,
draw/2]).
discards(#hand{tiles=Tiles} = Hand) ->
[{discard, Tile, Hand#hand{tiles = Tiles -- [Tile]}} || Tile <- Tiles].
draw(#hand{tiles = Tiles} = Hand, Tile) ->
Hand#hand{tiles = Tiles ++ [Tile]}.