Fixed hand scoring

This commit is contained in:
Correl Roush 2012-05-08 10:41:32 -04:00
parent e727679729
commit a50d5d3087

View file

@ -106,14 +106,14 @@ score_hand(#hand{}=Hand, BaseFu, Limit) ->
_Kokushi_Musou = fun(#hand{}=H) -> _Kokushi_Musou = fun(#hand{}=H) ->
Sets = find_sets(H#hand.tiles), 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), Terminals = not lists:any(fun(#tile{value=V}) -> lists:member(V, lists:seq(2,8)) end, H#hand.tiles),
Orphans = 13 == length([C || {C, _T} <- Sets, C == 1]), Orphans = 12 == length([C || {C, _T} <- Sets, C == 1]),
case Terminals and Orphans of case Terminals and Orphans of
true -> 13; true -> 13;
_ -> 0 _ -> 0
end end
end end
], ],
score(lists:sum(Fu), [F(Hand) || F <- Yakuman], Limit). score(lists:sum(Fu), lists:sum([F(Hand) || F <- Yakuman]), Limit).
find_sets(Tiles) -> find_sets(Tiles) ->
Unique = sets:to_list(sets:from_list(Tiles)), Unique = sets:to_list(sets:from_list(Tiles)),