% 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. Game of Life is 45
gol=a(:,:,end);
for ro = 1:totalrows;
for col = 1:columns;
pointup=(ro-1); pointdown=(ro+1); pointleft=(col-1);
pointright=(col+1);
if ro==1; pointup=totalrows; end;
if ro==totalrows; pointdown=1; end;
if col==1; pointleft=columns; end;
if col==columns; pointright=1; end;
neighbors=a(pointup,col,end) + a(pointdown,col,end)+a(ro,pointleft,end) +...
a(ro,pointright,end)+a(pointup,pointleft,end) + a(pointup,pointright,end) +...
a(pointdown,pointleft,end) + a(pointdown,pointright,end);
neighbors=(possiblestates+1)-neighbors-1;
changetoo=rulenumberbinary(neighbors);
if gol(ro,col)==5;
else changetoo<rulecolors;
gol(ro,col)=changetoo;
end;
end;
end;
a(:,:,end)=gol;