-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfloor.cpp
More file actions
51 lines (44 loc) ยท 1.43 KB
/
floor.cpp
File metadata and controls
51 lines (44 loc) ยท 1.43 KB
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
#include "floor.h"
void Floor::addCard(Hwatoo card) {
floor_list_.push_back(card);
} // ๋ฐ๋ฅํจ ๋ฆฌ์คํธ์ ์นด๋ ์ถ๊ฐ
Hwatoo* Floor::removeCard(Hwatoo card) { // ๋ฐ๋ฅ ํจ์์ ํน์ ์นด๋ ์ญ์
for (itor = floor_list_.begin(); itor != floor_list_.end();) {
if ((*itor).isSame(card)) {
Hwatoo* card = &(*itor);
floor_list_.erase(itor);
return card;
} else {
++itor;
}
}
return nullptr;
}
bool Floor::isEmptyFloorList() {
return this->floor_list_.empty();
} // ๋ฐ๋ฅํจ๊ฐ ๋ฆฌ์คํธ๊ฐ ๋น์ด์๋์ง ํ์ธ
void Floor::printCardList() { // ๋ฐ๋ฅํจ ๋ฆฌ์คํธ ์ถ๋ ฅ
for (itor = floor_list_.begin(); itor != floor_list_.end(); ++itor) {
std::cout << (*itor).getMonth() << (*itor).getKind() << " ";
}
}
// ๋งค๊ฐ๋ณ์๋ก ๋ฐ์ card์ floor_list์ ๊ฐ์ ์ข
๋ฅ์ ์นด๋๊ฐ ์๋ค๋ฉด cnt๋ฅผ ์ฆ๊ฐํ์ฌ
// ๋ฐํํ๋ค.
int Floor::sameCardCount(Hwatoo card) {
int cnt = 0;
for (itor = floor_list_.begin(); itor != floor_list_.end(); ++itor) {
if ((*itor).isSame(card)) cnt++;
}
return cnt;
}
// ๋งค๊ฐ๋ณ์๋ก ๋ฐ์ card์ floor_list์ ๊ฐ์ ์ข
๋ฅ์ ์นด๋๊ฐ ์๋ค๋ฉด ๋ณ์ list์
// ์ ์ฅํ์ฌ ๋ฐํํ๋ค.
std::vector<Hwatoo> Floor::sameCardList(Hwatoo card) {
std::vector<Hwatoo> list;
for (itor = floor_list_.begin(); itor != floor_list_.end(); ++itor) {
if ((*itor).isSame(card)) {
list.push_back(*itor);
}
}
return list;
}