diff --git a/teyaku.c b/teyaku.c index 58f5588..cd46ca7 100644 --- a/teyaku.c +++ b/teyaku.c @@ -3,7 +3,7 @@ #include "teyaku.h" #include "card.h" -SetTeyaku calculate_set_teyaku(Hand h) { +SetTeyaku calculate_set_teyaku(const Hand h) { int month_counts[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; int month_stands[12] = { 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1 }; for (int i = 0; i < h.count; i++) { @@ -38,7 +38,7 @@ SetTeyaku calculate_set_teyaku(Hand h) { return SET_TEYAKU_NONE; } -ChaffTeyaku calculate_chaff_teyaku(Hand h) { +ChaffTeyaku calculate_chaff_teyaku(const Hand h) { int ribbons = 0; int animals = 0; int brights = 0; @@ -67,22 +67,22 @@ static char *set_teyaku_english_array[11] = { "None", "Triplet", "Standing Tripl static int chaff_teyaku_points_array[6] = { 0, 2, 3, 3, 4, 4 }; static char *chaff_teyaku_english_array[6] = { "None", "Red", "One Ribbon", "One Animal", "One Bright", "Empty Hand" }; -int set_teyaku_points(Hand h) { +int set_teyaku_points(const Hand h) { return set_teyaku_points_array[calculate_set_teyaku(h)]; } -int chaff_teyaku_points(Hand h) { +int chaff_teyaku_points(const Hand h) { return chaff_teyaku_points_array[calculate_chaff_teyaku(h)]; } -char *set_teyaku_english(Hand h) { +char *set_teyaku_english(const Hand h) { return set_teyaku_english_array[calculate_set_teyaku(h)]; } -char *chaff_teyaku_english(Hand h) { +char *chaff_teyaku_english(const Hand h) { return chaff_teyaku_english_array[calculate_chaff_teyaku(h)]; } -int calculate_teyaku(Hand h) { +int calculate_teyaku(const Hand h) { return chaff_teyaku_points(h) + set_teyaku_points(h); } diff --git a/teyaku.h b/teyaku.h index 8728188..5b88078 100644 --- a/teyaku.h +++ b/teyaku.h @@ -26,12 +26,12 @@ typedef enum ChaffTeyaku { EMPTY_HAND, } ChaffTeyaku; -int calculate_teyaku(Hand h); -SetTeyaku calculate_set_teyaku(Hand h); -ChaffTeyaku calculate_chaff_teyaku(Hand h); -char *set_teyaku_english(Hand h); -char *chaff_teyaku_english(Hand h); -int set_teyaku_points(Hand h); -int chaff_teyaku_points(Hand h); +int calculate_teyaku(const Hand h); +SetTeyaku calculate_set_teyaku(const Hand h); +ChaffTeyaku calculate_chaff_teyaku(const Hand h); +char *set_teyaku_english(const Hand h); +char *chaff_teyaku_english(const Hand h); +int set_teyaku_points(const Hand h); +int chaff_teyaku_points(const Hand h); #endif