Name: Anonymous 2013-10-20 22:56
Post a random function that you made. May be from any project you've done or make one impromptu.
Any QUALITY is allowed. No bullying!
Any QUALITY is allowed. No bullying!
tic;
bigness = 20
x = rand(bigness) > rand(1);
fx = x;
oldfx = fx;
fx(:) = 0;
%figure(1); imshow(1-x); figure(2);
y = zeros(bigness + 2);
y(2:end-1, 2:end-1) = x;
zf = ones(3);
zf(2,2) = 10;
for(iter=1:200)
nextx = zfilter(y, zf);
%%rep = ((x==0) .+ (nextx==3)) == 2;
%%suv = ((x==1) .+ (nextx==2) .+ (nextx==3)) == 2;
%%x = rep .+ suv;
%%x = nextx==2;
x = (nextx==3) .+ (nextx==12) .+ (nextx==13);
y(:) = 0;
y(2:end-1, 2:end-1) = x;
if(mod(iter,5)==0)
xdiff = sum(abs(fx(:) .- oldfx(:))) ./ (bigness^2);
col(:,:,1) = fx;
col(:,:,2) = oldfx - fx;
col(:,:,3) = oldoldfx - fx;
imshow(col);
oldoldfx = oldfx;
oldfx = fx;
fx = x; %min(fx .* 0.5 .+ x, 1);
fprintf("%2.4f instability %c", xdiff, 13);
if(xdiff < (1/bigness))
iter
break;
endif;
sleep(0.75);
endif;
endfor;
toc