public final void init(){
        
        for (int i = 0; i < width; i++){
            
            for (int j = 0; j < height; j++){
                
                grid[i][j] = new Node(i,j);
                
            }
            
        }
        
        for (int i = 0; i < width; i++){
            
            for (int j = 0; j < height; j++){
            
                if((i+1) < width){
                    grid[i][j].setRightSide(grid[i+1][j]);
                }
                if((j+1) < height){
                    grid[i][j].setDownSide(grid[i][j+1]);
                }
                if((i-1) >=0){
                    grid[i][j].setLeftSide(grid[i-1][j]);
                }
                if((j-1) >=0){
                    grid[i][j].setUpSide(grid[i][j-1]);
                }
                
            }
            
        }
        
    }