mirror of
https://github.com/correl/riichi.git
synced 2024-12-17 19:16:12 +00:00
Scoring Suu An Kou
This commit is contained in:
parent
a2ce6164e9
commit
950f34b0bd
2 changed files with 19 additions and 0 deletions
|
@ -96,6 +96,13 @@ score_hand(#hand{}=Hand, BaseFu, Limit) ->
|
|||
_ -> 0
|
||||
end
|
||||
end,
|
||||
_Suu_An_Kou = fun(#hand{}=H) ->
|
||||
Sets = find_sets(H#hand.tiles),
|
||||
case 4 == length([C || {C, _T} <- Sets, C == 3]) of
|
||||
true -> 13;
|
||||
_ -> 0
|
||||
end
|
||||
end,
|
||||
_Kokushi_Musou = fun(#hand{}=H) ->
|
||||
Sets = find_sets(H#hand.tiles),
|
||||
Terminals = not lists:any(fun(#tile{value=V}) -> lists:member(V, lists:seq(2,8)) end, H#hand.tiles),
|
||||
|
|
|
@ -90,6 +90,18 @@ score_hand_dai_san_gan_test() ->
|
|||
lists:duplicate(3, #tile{suit=dragon, value=white}),
|
||||
lists:duplicate(3, #tile{suit=dragon, value=green}),
|
||||
lists:duplicate(3, #tile{suit=wind, value=east}),
|
||||
[#tile{suit=pin, value=V} || V <- [5,6,7]],
|
||||
lists:duplicate(2, #tile{suit=wind, value=north})])
|
||||
},
|
||||
?assertEqual(riichi:score_hand(Hand, 30), 8000).
|
||||
|
||||
score_hand_suu_an_kou_test() ->
|
||||
Hand = #hand{
|
||||
tiles = lists:flatten([
|
||||
lists:duplicate(3, #tile{suit=pin, value=1}),
|
||||
lists:duplicate(3, #tile{suit=pin, value=4}),
|
||||
lists:duplicate(3, #tile{suit=sou, value=2}),
|
||||
lists:duplicate(3, #tile{suit=man, value=8}),
|
||||
lists:duplicate(2, #tile{suit=wind, value=north})])
|
||||
},
|
||||
?assertEqual(riichi:score_hand(Hand, 30), 8000).
|
||||
|
|
Loading…
Reference in a new issue