Esempio n. 1
0
  /**
   * Updates all elements that are necessary after the state changed 1. Update all the seedAmounts
   * in the pits after a move was made 2. It enables only the pits from the player whose turn it is
   * 3. When there are zero seeds in a pit it can't be chosen either so disable them 4. Set a
   * message in the case of game over
   */
  void updateBoard() {

    if (usersSide == null) graphics.setTurnLabelText(messages.startNewGame());
    else {
      graphics.setTurnLabelText(
          state.getWhoseTurn().equals(usersSide)
              ? messages.itsYourTurn()
              : messages.opponentsTurn());
    }
    updatePits();
    enableActiveSide();
    disableZeroSeedPits();
    message();
  }