Update Board.cpp
This commit is contained in:
parent
07ee4ac6de
commit
95c1b20d1e
1 changed files with 24 additions and 24 deletions
48
Board.cpp
48
Board.cpp
|
@ -104,6 +104,29 @@ void Board::displayBoard()
|
||||||
cout<<"turn : "<<turn;
|
cout<<"turn : "<<turn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string Board::boardToString()
|
||||||
|
{
|
||||||
|
string temp;
|
||||||
|
temp.append("\n");
|
||||||
|
temp.append("\n");
|
||||||
|
temp.append("; A B C D E F G H\n");
|
||||||
|
for (int i = 0; i < 8; ++i)
|
||||||
|
{
|
||||||
|
int mango = 8 - i;
|
||||||
|
temp.append("; " + to_string(mango) + " ");
|
||||||
|
for (int j = 0; j < 8; ++j)
|
||||||
|
{
|
||||||
|
temp.append("|");
|
||||||
|
temp.push_back(boardArray[i][j]);
|
||||||
|
}
|
||||||
|
temp.append("|\n");
|
||||||
|
}
|
||||||
|
temp.append("\n");
|
||||||
|
temp.append("turn : " + turn);
|
||||||
|
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|
||||||
int Board::charToIntColumn(char input) //converts column number to int
|
int Board::charToIntColumn(char input) //converts column number to int
|
||||||
{
|
{
|
||||||
int kolumn;
|
int kolumn;
|
||||||
|
@ -510,7 +533,7 @@ void Board::interpret(string input, Board& tablero) //determines what kind of co
|
||||||
else if (input == "DISPLAYRECORD") //for debugging purposes
|
else if (input == "DISPLAYRECORD") //for debugging purposes
|
||||||
{
|
{
|
||||||
cout<<"record: "<<endl;
|
cout<<"record: "<<endl;
|
||||||
cout<<record.size();
|
//cout<<record.size();
|
||||||
for (int i = 0; i < record.size(); ++i)
|
for (int i = 0; i < record.size(); ++i)
|
||||||
{
|
{
|
||||||
record[i].displayBoard();
|
record[i].displayBoard();
|
||||||
|
@ -559,26 +582,3 @@ void Board::easyAI()
|
||||||
//cout<<"\n\nMove executed by AI: "<<listOfMoves[temp].column<<" "<<listOfMoves[temp].row<<" "<<listOfMoves[temp].moveType<<endl; uncomment for debugging purposes
|
//cout<<"\n\nMove executed by AI: "<<listOfMoves[temp].column<<" "<<listOfMoves[temp].row<<" "<<listOfMoves[temp].moveType<<endl; uncomment for debugging purposes
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string Board::boardToString()
|
|
||||||
{
|
|
||||||
string temp;
|
|
||||||
temp.append("\n");
|
|
||||||
temp.append("\n");
|
|
||||||
temp.append("; A B C D E F G H\n");
|
|
||||||
for (int i = 0; i < 8; ++i)
|
|
||||||
{
|
|
||||||
int mango = 8 - i;
|
|
||||||
temp.append("; " + to_string(mango) + " ");
|
|
||||||
for (int j = 0; j < 8; ++j)
|
|
||||||
{
|
|
||||||
temp.append("|");
|
|
||||||
temp.push_back(boardArray[i][j]);
|
|
||||||
}
|
|
||||||
temp.append("|\n");
|
|
||||||
}
|
|
||||||
temp.append("\n");
|
|
||||||
temp.append("turn : " + turn);
|
|
||||||
|
|
||||||
return temp;
|
|
||||||
}
|
|
Reference in a new issue