summaryrefslogtreecommitdiff
path: root/src/card.c
diff options
context:
space:
mode:
authorMario Kilies <MarioKilies@GMX.net>2011-01-04 20:13:39 +0100
committerMario Kilies <MarioKilies@GMX.net>2011-01-04 20:13:39 +0100
commitc076d1849d9ec07b87cde212d8db12dc890dc811 (patch)
tree99446082551d1434e9c61b0de6dc5f31363daa9d /src/card.c
parent5060d22270bc4c84cc5d16cf593e389e40f2b13f (diff)
Splitted up content from common.* to separate files (card.[ch], cardstack.[ch] and hand.h)
Diffstat (limited to 'src/card.c')
-rw-r--r--src/card.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/card.c b/src/card.c
new file mode 100644
index 0000000..73808a4
--- /dev/null
+++ b/src/card.c
@@ -0,0 +1,12 @@
+#include "card.h"
+#include <assert.h>
+
+uint32_t card_get_points(const card c)
+{
+ assert(c > 0 && c <= 105);
+ if (55 == c) return 7; // Card 55 is worth of 7 points
+ if (c % 11 == 0) return 5; // Cards that are multiples of 11 are worth 5 points
+ if (c % 10 == 0) return 3; // ... 10 are worth 3 points
+ if (c % 5 == 0) return 2; // ... 5 are worth 2 points
+ return 1; // All other cards are worth 1 point
+}