From c037ea48cc798c57560a0c9ec507836197847f5b Mon Sep 17 00:00:00 2001 From: Rebecca Schofield Date: Tue, 27 Oct 2015 11:51:37 -0500 Subject: [PATCH] finished board to string --- Board.cpp | 28 ++++++++++++++++++++++++++++ Board.h | 1 + test.cpp | 1 + 3 files changed, 30 insertions(+) diff --git a/Board.cpp b/Board.cpp index f02ebbb..8051c3c 100755 --- a/Board.cpp +++ b/Board.cpp @@ -114,6 +114,34 @@ void Board::displayBoard(){ cout<<'\n'<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; diff --git a/Board.h b/Board.h index c4bf1f6..69bfe68 100755 --- a/Board.h +++ b/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); diff --git a/test.cpp b/test.cpp index ba030f6..2851e14 100755 --- a/test.cpp +++ b/test.cpp @@ -7,6 +7,7 @@ int main() { //board testing Board b; + cout << b.boardToString(); //engine testing Engine e;