function pos = MakeAtm(ax,ay,az)

p1x = zeros(1,az);
p1y = zeros(1,az);

for i = 1:az
    r = rand();
    if r <= 0.25
        p1y(i) = ay(i);
        g = find(p1x == ax(i)+1 & p1y == p1y(i));
        if length(g) == 0 
            p1x(i) = ax(i)+1;
        else if length(g) > 0
            g = find(p1x == ax(i)+2);
            if length(g) == 0
                p1x(i) = ax(i)+2;
            else if length(g) > 0
                    g = find(p1x == ax(i)+3);
                    if length(g) == 0
                        p1x(i) = ax(i)+3;
                    end
                end
            end
            end
        end
    end
    if r > 0.25 & r <= 0.5
        p1y(i) = ay(i);
        g = find(p1x == ax(i)-1 & p1y == ay(i));
        if length(g) == 0
            p1x(i) = ax(i)-1;
        else if length(g) > 0
                g = find(p1x == ax(i)-2);
                if length(g) == 0
                    p1x(i) = ax(i)-2;
                else if length(g) > 0
                        g = find(p1x == ax(i)-3);
                        if length(g) == 0
                            p1x(i) = ax(i)-3;
                        end
                    end
                end
            end
        end
    end
    if r >0.5 & r <= 0.75
        p1x(i) = ax(i);
        g = find(p1y == ay(i)+1 & p1x == p1x(i));
        if length(g) == 0
            p1y(i) = ay(i)+1;
        else if length(g) > 0
                g = find(p1y == ay(i)+2);
                if length(g) == 0
                    p1y(i) = ay(i)+2;
                else if length(g) > 0
                        g = find(p1y == ay(i)+3);
                        if length(g) == 0
                            p1y(i) = ay(i)+3;
                        end
                    end
                end
            end
        end
    end
    if r>0.75 & r <= 0.75
        g = find(p1y == ay(i)-1 & p1x == p1x(i));
        p1x(i) = ax(i);
        if length(g) == 0
            p1y(i) = ay(i)-1;
        else if length(g) > 0
                g = find(p1y == ay(i)-2);
                if length(g) == 0
                    p1y(i) = ay(i)-2;
                else if length(g) > 0
                        g = find(p1y == ay(i)-3);
                        if length(g) == 0
                            p1y(i) = ay(i)-3;
                        end
                    end
                end
            end
        end
    end
end

pos = struct('p1x', p1x, 'p1y', p1y);
end
