Commit b61b4b31184954cb39e0354259a230fb71164504

Authored by Thomas R. Koll
1 parent 52defbc234
Exists in master

Add Player.won

Showing 1 changed file with 4 additions and 1 deletions Side-by-side Diff

... ... @@ -26,6 +26,9 @@
26 26 stones[i] = Stone();
27 27 }
28 28 };
  29 + bool won() {
  30 + score == PLAYER_STONES;
  31 + };
29 32 };
30 33  
31 34 struct Game {
... ... @@ -88,7 +91,7 @@
88 91 #ifdef DEBUG
89 92 printf("Starting game...\n");
90 93 #endif
91   - while(playerOne.score < 6 && playerTwo.score < 6 && game.numberOfTurns < 100) {
  94 + while(! playerOne.won() && ! playerTwo.won() && game.numberOfTurns < 100) {
92 95 game.numberOfTurns++;
93 96 turn(game.numberOfTurns % 2 ? playerOne : playerTwo);
94 97 }