What should be the base cae in my Code?

import java.util.*;
class Main{
public static Scanner scn = new Scanner(System.in);
public static void main(String [] args){

    // SUDOKU();
    // nqueen();
    // rat();
    funky();

}

public static void funky(){
    int n = scn.nextInt();
    int [][] arr = new int[n][n];
    int count_1 = 0;
    for(int i =0; i< n; i++){
        for(int j = 0; j< n; j++){
            arr[i][j]=scn.nextInt();
            if(arr[i][j]==1){
                count_1++;
            }
        }
    }

    System.out.println(funkyChess(arr,0,0,count_1));

}

public static int funkyChess(int [][] grid, int i, int j, int count_1){

    grid[i][j]=0;
    count_1--;

    if(count_1==0){
        return 0;
    }

    if(i+2<grid.length && j+1 < grid.length && isPosSafe(grid,i+2,j+1)){
        
        funkyChess(grid,i+2,j+1,count_1);
    }

    
    if(i+2<grid.length && j-1 >= 0 && isPosSafe(grid,i+2,j-1)){
        
        funkyChess(grid,i+2,j-1,count_1);
    }

    if(i+1<grid.length && j+2 < grid.length && isPosSafe(grid,i+1,j+2)){
        
        funkyChess(grid,i+1,j+2,count_1);
    }
    if(i+1<grid.length && j-2 >=0 && isPosSafe(grid,i+1,j-2)){
        
        funkyChess(grid,i+1,j-2,count_1);
    }
    if(i-1>=0 && j+2 < grid.length && isPosSafe(grid,i-1,j+2)){
        
        funkyChess(grid,i-1,j+2,count_1);
    }
    if(i-1>=0 && j-2 >=0 && isPosSafe(grid,i-1,j-2)){
        
        funkyChess(grid,i-1,j-2,count_1);
    }
    if(i-2>=0 && j+1 < grid.length && isPosSafe(grid,i-2,j+1)){
        
        funkyChess(grid,i-2,j+1,count_1);
    }
    if(i-2>=0 && j-1 >=0 && isPosSafe(grid,i-2,j-1)){
        
        funkyChess(grid,i-2,j-1,count_1);
    }

    grid[i][j]=1;
    return count_1;
}


public static boolean isPosSafe(int [][]grid, int row, int col){
    if(grid[row][col]==1){
        return true;
    }

    return false;
}

}

@ap8730390,
Corrected code. https://ide.codingblocks.com/s/250945

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.