private boolean find(char[][] board, boolean[][] visited, int i, int j) {
        if (i - 1 < 0 || i + 1 >= board.length || j - 1 < 0 || j + 1 >= board[0].length) {
            return false;
        }

        int[] rowStep = {-1, 1, 0, 0};
        int[] colStep = {0, 0, -1, 1};

        for (int t = 0; t < 4; t++) {
            if (visited[i + rowStep[t]][j + colStep[t]] == false &&
                    board[i + rowStep[t]][j + colStep[t]] == 'O') {
                visited[i + rowStep[t]][j + colStep[t]] = true;
                boolean result = find(board, visited, i + rowStep[t], j + colStep[t]);
                if (result == true) {
                    board[i + rowStep[t]][j + colStep[t]] = 'X';
                } else {
                    return false;
                }
            }
        }
        return true;


    }