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

rules_twod_totalistic.m
% This is not setup like Wolfram's!  I don't know how he represents the
% concept of a cell staying the same in binary.  I tried different ideas
% w/o success.  My system uses a value one higher than your cell value
% choices to represent staying the same.  But my code numbers will be
% different from his.  GOL is 45
gol=a(:,:,end);
for ro = 2:(totalrows-1);
    for col = 2:(columns-1);
        neighbors=a(ro-1,col,end)+a(ro+1,col,end)+a(ro,col-1,end)+a(ro,col+1,end)+a(ro-1,col-1,end)+a(ro-1,col+1,end)+a(ro+1,col-1,end)+a(ro+1,col+1,end);
        neighbors=(possiblestates+1)-neighbors-1;
        changetoo=rulenumberbinary(neighbors);
        if changetoo<rulecolors;
            gol(ro,col)=changetoo;
        end;
    end;
end;
a(:,:,end)=gol;

Contact us at files@mathworks.com