public ArrayList<Position> inNeighboring(char[][] board, Position p, char x, int xSize, int ySize) {
        ArrayList<Position> neighbor = new ArrayList<Position>();
        if (p.x + 1 < xSize && board[p.x + 1][p.y] == x) {
            neighbor.add(new Position(p.x + 1, p.y));
        }
        if (p.x - 1 >= 0 && board[p.x - 1][p.y] == x) {
            neighbor.add(new Position(p.x - 1, p.y));
        }
        if (p.y + 1 < ySize && board[p.x][p.y + 1] == x) {
            neighbor.add(new Position(p.x, p.y + 1));
        }
        if (p.y - 1 >= 0 && board[p.x][p.y - 1] == x) {
            neighbor.add(new Position(p.x, p.y - 1));
        }
        return neighbor;

    }