function automaton(rulez)
%clear all
% clf

maxY = 100;
maxX = maxY*2 + 1;
rule = rulez;

% create cells
cells = zeros(maxX,maxY);
cells(ceil(maxX/2),maxY) = 1;


for row=maxY-1:-1:1
    newRow = place_check(cells(:,row+1), rule); %pass in the previous row to make the new one
    cells(:,row) = newRow;
    
    imagesc(cells')
    set(gca,'YDir','normal');
    colormap(1-gray);
    axis equal;
    axis tight;
    pause(0.01)
    
end