Merge branch 'beccadev' into alex
This commit is contained in:
commit
d874a13d99
3 changed files with 30 additions and 0 deletions
28
Board.cpp
28
Board.cpp
|
@ -115,6 +115,34 @@ void Board::displayBoard(){
|
|||
cout<<"turn: "<<turn << "\n";
|
||||
}
|
||||
|
||||
string Board::boardToString(){
|
||||
string output = "";
|
||||
output += "; A B C D E F G H\n";
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
int label = 8 - i;
|
||||
output += "; ";
|
||||
output += label;
|
||||
output += " ";
|
||||
for (int j = 0; j < 8; ++j){
|
||||
if (isPiece(i, j))
|
||||
if (getPiece(i, j)->getType() == 'X')
|
||||
output += "|X";
|
||||
else
|
||||
output += "|O";
|
||||
else
|
||||
output += "|_";
|
||||
}
|
||||
|
||||
output += "|\n";
|
||||
}
|
||||
|
||||
output += "\n\nturn: ";
|
||||
output += turn;
|
||||
output += "\n";
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
int Board::charToIntColumn(char input){
|
||||
int kolumn;
|
||||
|
||||
|
|
1
Board.h
1
Board.h
|
@ -35,6 +35,7 @@ public:
|
|||
bool isGameOver();
|
||||
void changeTurns();
|
||||
void displayBoard();
|
||||
string boardToString();
|
||||
int charToIntColumn(char input);
|
||||
char intToCharColumn(int input);
|
||||
void move(string inputMove);
|
||||
|
|
1
test.cpp
1
test.cpp
|
@ -7,6 +7,7 @@ int main()
|
|||
{
|
||||
//board testing
|
||||
Board b;
|
||||
cout << b.boardToString();
|
||||
|
||||
//engine testing
|
||||
Engine e;
|
||||
|
|
Reference in a new issue