public static void moveToOpen(int[][] grid, int i, int j, int threshold, int numOpen)
    {
        int countOpenUnsatisfied = 0;
        if(grid[i][j] != 2)
        {
            boolean q = isSatisfied(grid, i, j, threshold);
            if(q == false)
            {
                for(int x = 0; x < grid.length; x++)
                {
                    for(int y = 0; y < grid[0].length; y++)
                    {
                        if(grid[x][y] == 2)
                        {
                            grid[x][y] = grid[i][j];
                            boolean z = isSatisfied(grid, x, y, threshold);
                            if(z == true)
                            {
                                grid[i][j] = 2;
                                return;
                            }
                            else
                            {
                                grid[x][y] = 2;
                                countOpenUnsatisfied++;
                            }
                        }
                    }
                }
            }
        }
        if(countOpenUnsatisfied == numOpen)
        {
            moveToRandomOpen(grid, i, j, numOpen);
        }
    }