I can't pass the 1d array into the method because there is a 2d array parameter. I can't remove the 2d array parameter because my 2048 game board runs on that 2d array board subject. Is there a workaround? I want the slideUp
to work on temp and still keep my 2d array parameter board.
public void slideUp(int[][] board) {
for (int column = 0; column < board[0].length; column++) {
int[] temp = getCol(board, column);
slideUp(temp);
for (int i = 0; i < board[0].length; i++) {
board[i][column] = temp[i];
}
}
}
Error code: incompatible types: int[] cannot be converted to int[][] slideUp(temp);