-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScore.cpp
68 lines (58 loc) · 1.6 KB
/
Score.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include<iostream>
#include "Score.h"
#include "Player.h"
int Score::getScore(std::vector<Card*>& vector) {
total_score_ = 0;
scoreofpi_ = 0;
scoreofgwang_ = 0;
for (int i = 0; i < 9; i++) {
numoftype[i] = 0;
}
for (int i = 0; i < vector.size(); i++) {
numoftype[vector.at(i)->type()]++;
}
if (numoftype[0] + numoftype[1] == 5) { //광과 비광 점수 합계
total_score_ += 15;
scoreofgwang_ += 15;
}
else if (numoftype[0] + numoftype[1] == 4) {
total_score_ += 4;
scoreofgwang_ += 4;
}
else if (numoftype[0] == 2 && numoftype[1] == 1) {
total_score_ += 2;
scoreofgwang_ += 2;
}
else if (numoftype[0] == 3) {
total_score_ += 3;
scoreofgwang_ += 3;
}
if (numoftype[3] == 3) { //고도리
total_score_ += 5;
}
if (numoftype[2] >= 5) { //열끗 (개수 - 4 = 점수)
total_score_ += (numoftype[2] - 4);
}
if (numoftype[4] == 3) { //초단
total_score_ += 3;
}
if (numoftype[5] == 3) { //청단
total_score_ += 3;
}
if (numoftype[6] == 3) { //홍단
total_score_ += 3;
}
if (numoftype[4] + numoftype[5] + numoftype[6] >= 5) { //청홍띠 단의 합개수
total_score_ += (numoftype[4] + numoftype[5] + numoftype[6] - 4);
}
if (numoftype[7] + (2 * numoftype[8]) >= 10) { //피
total_score_ += (numoftype[7] + (2 * numoftype[8]) - 9);
scoreofpi_ += (numoftype[7] + (2 * numoftype[8]) - 9);
}
if (scoreofpi_ < 0) {
scoreofpi_ = 0;
}
numofgwang_ = numoftype[0] + numoftype[1];
numofpi_ = numoftype[7] + (2 * numoftype[8]);
return total_score_;
}