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_oned_next_nearest_totalistic_setup.m
clear rulenumber* changetoo*
ruletotalvalue=inputdlg({'Rule Number','Number of Possible Colors(Cell Values)'},'',1);
rulenumber=ruletotalvalue{1};
rulecolors=ruletotalvalue{2};
rulenumber=eval(rulenumber);
rulecolors=eval(rulecolors);
possiblestates=((rulecolors-1)*5)+1;
rulenumberbinaryfirst=dec2base(rulenumber,rulecolors,possiblestates);
rulenumberbinary=num2matrix(rulenumberbinaryfirst);

% Rulenumberbinary is a number with as many digits as states.
% The rule number converted to base "rulecolors" equals the results for each
% possible state in that rule.
% Rulenumber equals base2dec('rulebinary',rulecolors)
% You can generate rulebinary then solve for the rule number.

Contact us at files@mathworks.com