-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCell.cpp
48 lines (37 loc) · 940 Bytes
/
Cell.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
#include "Cell.h"
Cell::Cell(unsigned long row, unsigned long col) : row(row), col(col) {}
Cell::Cell(unsigned long row, unsigned long col, CellValue value) : row(row), col(col), value(value) {}
CellValue Cell::getValue() const {
return value;
}
void Cell::setValue(CellValue value) {
Cell::value = value;
}
std::string Cell::getStringValue() const {
switch (value) {
case X:
return "X";
case O:
return "O";
case Empty:
return " ";
default:
return "";
}
}
std::string Cell::convertValueToString(CellValue value) {
Cell tmpCell{0, 0, value};
return tmpCell.getStringValue();
}
unsigned long Cell::getRow() const {
return row;
}
unsigned long Cell::getCol() const {
return col;
}
const std::string &Cell::getColor() const {
return color;
}
void Cell::setColor(const std::string &color) {
Cell::color = color;
}