mirror of
https://github.com/correl/riichi.git
synced 2024-11-23 19:19:55 +00:00
13 lines
281 B
Erlang
13 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]}.
|