Skip to content

Commit

Permalink
Check Wins working
Browse files Browse the repository at this point in the history
  • Loading branch information
kylewillis21 committed Apr 27, 2024
1 parent 5926757 commit 31861e4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Server/board.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
13 changes: 8 additions & 5 deletions Server/game.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ void game::startGame(){
cin >> destination;
} while(!makeMove(target,destination));
turnNum++;
updatePieceCount();
}
return;
}
Expand Down Expand Up @@ -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++;
}
}
}
}
Expand Down

0 comments on commit 31861e4

Please sign in to comment.