% bold play probabilities
%for p=[0.1 0.25 9/19 0.5]
%p=0.5; 
for p=[0.05:0.05:0.5]
Pn=zeros(1,1);
Pn(1)=1; 
sizePn=1;
for nop=0:10
    sizeQn=2*sizePn;
    Qn=zeros(1,sizeQn);
    for i=1:sizeQn 
        if (mod(i,2)==0)
            Qn(i)=Pn(i/2);
        elseif (i<=sizePn)
            Qn(i)=p*Pn(i);
        else
            Qn(i)=p+(1-p)*Pn(i-sizePn);
        end
    end
    Pn=Qn;
    sizePn=sizeQn; 
end
t=[0:sizePn]/sizePn; 
 
grid on;
axis equal;
plot(t,[0 Pn], 'LineWidth',1.5, 'Color', [abs(1-2*p)^(1/3) 0 0] );
hold on;
xlabel('$x$', 'Interpreter', 'Latex')
ylabel('$P(x)$', 'Interpreter', 'Latex'); 
axis equal;
axis([0 1 0 1]);
end
title('Bold play probabilities','FontSize',10);
hold off;
            
            