%%
clear
[ C, R ] = triangulo( 1e5 );
figure
hold on
plot( C(R==1), '.b' )
plot( C(R==2), '.r' )
plot( C(R==3), '.y' )

%%
clear
N = 100e3;
figure
hold on
C(N) = 0;
% C = zeros(N,1);
C(1) = rand + 1i*rand;
tic
for i=1:(N-1)
    regra = rand;
    if regra<1/3
        C(i+1) = C(i)/2;
    elseif regra<2/3
        C(i+1) = C(i)/2 + 1;
    else
        C(i+1) = C(i)/2 + 0.5 + 1i;
    end
%    plot( C, '.k' )
end
toc
plot( C, '.k' )
