Add Player.won

parent 52defbc2
...@@ -26,6 +26,9 @@ struct Player { ...@@ -26,6 +26,9 @@ struct Player {
stones[i] = Stone(); stones[i] = Stone();
} }
}; };
bool won() {
score == PLAYER_STONES;
};
}; };
struct Game { struct Game {
...@@ -88,7 +91,7 @@ int main() { ...@@ -88,7 +91,7 @@ int main() {
#ifdef DEBUG #ifdef DEBUG
printf("Starting game...\n"); printf("Starting game...\n");
#endif #endif
while(playerOne.score < 6 && playerTwo.score < 6 && game.numberOfTurns < 100) { while(! playerOne.won() && ! playerTwo.won() && game.numberOfTurns < 100) {
game.numberOfTurns++; game.numberOfTurns++;
turn(game.numberOfTurns % 2 ? playerOne : playerTwo); turn(game.numberOfTurns % 2 ? playerOne : playerTwo);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment