So I am working on a game of Chomp. Where you have a grid of "cookies" and a "poison cookie" in the bottom left corner. When a player selects a cookie, all the cookies up and to the right of that cookie are eaten.
Right now, my program selects all the cookies up and to the left of the cookie selected. Below is the updateBoard method that gets passed in the row and column from the mouse click and changes the type of each "cookie". My question is how to select the cookies to the right instead of the left?
static void updateBoard(int Row, int Column){
if(gb1.arrayName1[Row][Column].getType() == 1){
gb1.arrayName1[Row][Column].setType(currentPlayer);
if(currentPlayer == Player1){
for(int i = 0; i <= Row; i++){
for(int j = 0; j <= Column; j++){
if(gb1.arrayName1[i][j].getType() != Player2){
gb1.arrayName1[i][j].setType(Player1);
}
}
}
turn.setText("Player2's turn");
currentPlayer = Player2;
}else if (currentPlayer == Player2){
for(int i= 0; i <= Row; i++){
for(int j = 0; j <= Column; j++){
if(gb1.arrayName1[i][j].getType() != Player1){
gb1.arrayName1[i][j].setType(Player2);
}
}
}
turn.setText("Player1's turn");
currentPlayer=Player1;
}
}else if(gb1.arrayName1[Row][Column].getType() == 4){
turn.setText("Poison cookie eaten, Game Over!");
}
}