Пример #1
0
 public void doTurn(int pitIndex) {
   // if current player doesn't get second, go to next one
   boolean playAgain = board.makeMove(currentPlayerIndex, pitIndex);
   // check if need to keep going or stop the game
   if (board.hasMoreStones(currentPlayerIndex)) {
     if (!playAgain) {
       currentPlayerIndex = board.getNextPlayerIndex(currentPlayerIndex);
     }
   }
   // stop the game
   else {
     // change player index to next player with stones left
     currentPlayerIndex = board.getNextPlayerIndex(currentPlayerIndex);
     // grab anything left on other side
     board.emptyPits(currentPlayerIndex);
     isDone = true;
   }
 }