summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/score.cpp18
-rw-r--r--server/score.h13
2 files changed, 22 insertions, 9 deletions
diff --git a/server/score.cpp b/server/score.cpp
index 1af1d63..4589efe 100644
--- a/server/score.cpp
+++ b/server/score.cpp
@@ -8,28 +8,32 @@ inline int max(int x, int y) {
return x > y ? x : y;
}
-Score::Score(int han_, int fu_) : han(han_), fu(fu_) {
+Score::Score(int yaku_, int fu_, int dora_) : yaku(yaku_), fu(fu_), dora(dora_) {
}
+int Score::han() {
+ return yaku + dora;
+}
+
int Score::base_points() {
- if(han < 5) {
+ if(han() < 5) {
// Normal hand.
- return max(roundup(fu, 10) << (2 + han), 2000);
+ return max(roundup(fu, 10) << (2 + han()), 2000);
- } else if(han <= 5) {
+ } else if(han() <= 5) {
// Mangan.
return 2000;
- } else if(han <= 7) {
+ } else if(han() <= 7) {
// Haneman.
return 3000;
- } else if(han <= 10) {
+ } else if(han() <= 10) {
// Baiman.
return 4000;
- } else if(han <= 12) {
+ } else if(han() <= 12) {
// Sanbaiman.
return 6000;
diff --git a/server/score.h b/server/score.h
index 7c5ca17..677fde8 100644
--- a/server/score.h
+++ b/server/score.h
@@ -3,11 +3,20 @@
class Score {
public:
- int han;
+ //! Points (doubles).
+ int yaku;
+
+ //! Minipoints.
int fu;
+ //! Bonus points.
+ int dora;
+
//! Constructor.
- Score(int han_ = 0, int fu_ = 0);
+ Score(int yaku_ = 0, int fu_ = 0, int dora_ = 0);
+
+ //! Calculate han. (yaku + dora)
+ int han();
//! Calculate base points.
int base_points();