diff --git a/src/riichi.erl b/src/riichi.erl index f9f3738..f09b26b 100644 --- a/src/riichi.erl +++ b/src/riichi.erl @@ -50,21 +50,21 @@ nearest(Num, To) -> Num - (Num rem To) + To. -score(_Fu, Yaku, Limit) when (Yaku >= 5) and (Limit == true) -> +score(_Fu, Han, Limit) when (Han >= 5) and (Limit == true) -> if - Yaku < 6 -> + Han < 6 -> 2000; - Yaku < 8 -> + Han < 8 -> 3000; - Yaku < 11 -> + Han < 11 -> 4000; - Yaku < 14 -> + Han < 14 -> 6000; true -> 8000 end; -score(Fu, Yaku, Limit) -> - Score = nearest(Fu * round(math:pow(2, 2 + Yaku)), 100), +score(Fu, Han, Limit) -> + Score = nearest(Fu * round(math:pow(2, 2 + Han)), 100), if Limit and (Score > 2000) -> 2000; diff --git a/test/riichi_tests.erl b/test/riichi_tests.erl index 147f693..21913df 100644 --- a/test/riichi_tests.erl +++ b/test/riichi_tests.erl @@ -60,8 +60,8 @@ nearest_test_() -> [?_assertEqual(riichi:nearest(Val, 10), 80) || Val <- lists:seq(71,80)]. score_yaku_limit_test_() -> - [?_assertEqual(riichi:score(30, Yaku, true), Score) - || {Yaku, Score} <- + [?_assertEqual(riichi:score(30, Han, true), Score) + || {Han, Score} <- [ { 5, 2000}, { 6, 3000},