Add Player.won

parent 52defbc2
......@@ -26,6 +26,9 @@ struct Player {
stones[i] = Stone();
}
};
bool won() {
score == PLAYER_STONES;
};
};
struct Game {
......@@ -88,7 +91,7 @@ int main() {
#ifdef DEBUG
printf("Starting game...\n");
#endif
while(playerOne.score < 6 && playerTwo.score < 6 && game.numberOfTurns < 100) {
while(! playerOne.won() && ! playerTwo.won() && game.numberOfTurns < 100) {
game.numberOfTurns++;
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