拆分多个文件。
This commit is contained in:
45
OOP/FiveInARow/chessPiece.cpp
Normal file
45
OOP/FiveInARow/chessPiece.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
#include "fiveInARow.h"
|
||||
|
||||
ChessPiece::ChessPiece() {
|
||||
this->isEmptyStatus = true;
|
||||
this->isWinStatus = false;
|
||||
this->color = BLACK;
|
||||
}
|
||||
|
||||
ChessPiece::~ChessPiece() {
|
||||
}
|
||||
|
||||
void ChessPiece::setColor(bool newColor) {
|
||||
this->isEmptyStatus = false;
|
||||
this->color = newColor;
|
||||
}
|
||||
|
||||
void ChessPiece::setWin() {
|
||||
this->isWinStatus = true;
|
||||
}
|
||||
|
||||
void ChessPiece::reset() {
|
||||
this->isEmptyStatus = true;
|
||||
this->isWinStatus = false;
|
||||
this->color = BLACK;
|
||||
}
|
||||
|
||||
bool ChessPiece::isEmpty() {
|
||||
return this->isEmptyStatus;
|
||||
}
|
||||
|
||||
bool ChessPiece::getColor() {
|
||||
return this->color;
|
||||
}
|
||||
|
||||
std::string ChessPiece::show() {
|
||||
if (this->isWinStatus) {
|
||||
return "X";
|
||||
}
|
||||
if (this->color == BLACK) {
|
||||
return "⬤";
|
||||
}
|
||||
else {
|
||||
return "◯";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user