/** When there are zero seeds in a pit it can't be chosen either so disable them */ void disableZeroSeedPits() { int[] activePits = new int[7]; if (state.getWhoseTurn().isNorth()) activePits = state.getNorthPits(); else activePits = state.getSouthPits(); // state.getNorthPits().length-1 because the last array field is the // treasure chest for (int i = 0; i < state.getNorthPits().length - 1; i++) { if (activePits[i] == 0) graphics.setPitEnabled(state.getWhoseTurn(), i, false); } }
/** Update all the seedAmounts in the pits after a move was made */ private void updatePits() { for (int i = 0; i < state.getNorthPits().length; i++) { graphics.setSeeds(PlayerColor.N, i, state.getNorthPits()[i]); graphics.setSeeds(PlayerColor.S, i, state.getSouthPits()[i]); } }