I'm trying to make a Mancala game for my class and for the base code of dispersing the seeds here is what I have. K is what is passed for the position of the board that I am taking the seeds out of
Here is the initial code
public class Mancala {
private static final int BOARD_SIZE = 14;
private static final int START_SEEDS=4;
private int[] board;
public Mancala(){
board = new int[BOARD_SIZE];
for(int i = 0; i < board.length; i++)
board[i]=START_SEEDS;
board[0]=0;
board[BOARD_SIZE/2]=0;
}
public boolean makeMove(int k){
int seeds = board[k];
while(seeds>0){
for(int i = k; i <= board.length; i++){
seeds--;
board[i]++;
}
}
board[k] = seeds;
I keep getting an out of bounds error on board[i]++ ? Any idea?