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; } }
public int getScore(int playerIndex) { return board.getScore(playerIndex); }
// question for professor: what does it mean we methods repeat from lower level classes to upper // classes ? public int[] getPitsCounts(int playerIndex) { return board.getPitsCounts(playerIndex); }