Fixed terminology from Yaku to Han

This commit is contained in:
Correl Roush 2012-05-04 13:49:13 -04:00
parent 6a030241e3
commit 3cadb3bdbc
2 changed files with 9 additions and 9 deletions

View file

@ -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;

View file

@ -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},