diff --git a/Server/board.cc b/Server/board.cc index e6fadab..4574d8a 100644 --- a/Server/board.cc +++ b/Server/board.cc @@ -266,7 +266,7 @@ void board::output(std::ostream& outs)const{ outs << " _________________\n"; for(int i = 7; i >= 0; i--){ outs << i << " "; - for(int j = 7; j >= 0; j--){ + for(int j = 0; j < 8; j++){ outs << "|" << mainBoard[i][j]; } outs << "|\n" << " _________________\n"; diff --git a/Server/game.cc b/Server/game.cc index 50e9eb8..8ad03f2 100644 --- a/Server/game.cc +++ b/Server/game.cc @@ -43,6 +43,7 @@ void game::startGame(){ cin >> destination; } while(!makeMove(target,destination)); turnNum++; + updatePieceCount(); } return; } @@ -76,11 +77,13 @@ void game::updatePieceCount(){ for(int i = 0; i < 7; i++){ for(int j = 0; j < 7; j++){ - if(gameBoard.getSpaceFromBoard(i, j).getCurrentPiece()->getColor() == "red"){ - redCount++; - } - else if(gameBoard.getSpaceFromBoard(i, j).getCurrentPiece()->getColor() == "black"){ - blackCount++; + if(!gameBoard.getSpaceFromBoard(i, j).getIsEmpty()){ + if(gameBoard.getSpaceFromBoard(i, j).getCurrentPiece()->getColor() == "red"){ + redCount++; + } + else if(gameBoard.getSpaceFromBoard(i, j).getCurrentPiece()->getColor() == "black"){ + blackCount++; + } } } }