riichi/src/hand.erl

13 lines
281 B
Erlang
Raw Normal View History

2013-06-15 03:43:46 +00:00
-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]}.