Code covered by the BSD License  

Highlights from
Digital Karma: State Graphing

image thumbnail
from Digital Karma: State Graphing by Aman Siddiqi
Evolutionary Simulation, Interaction Graph

initial1d=clumps_initial1d(zeros_number,random_changes,clumps_range,rulecolors)
function initial1d=clumps_initial1d(zeros_number,random_changes,clumps_range,rulecolors)
% Input the number of zeros, number of changes, the clump size, rulecolors
%zeros_number=20; random_changes=4; clumps_range=3;
initial1d=zeros(1,zeros_number);
clump=randint(1,random_changes,[1,clumps_range]);
startingchangingrow=randint(1,random_changes,[1,zeros_number]);
startingchangingrowsize=size(startingchangingrow);
for scr=1:startingchangingrowsize(2);
    initial1d(1,startingchangingrow(scr):startingchangingrow(scr)+clump(scr)-1)=...
        randint(1,1,[1,rulecolors-1]);
end;

Contact us at files@mathworks.com