Since the center of each plane is available to all the others, it is sometimes useful to construct a counter from the spare cells in the remaining planes, with intent to incorporate it in the evolutionary rule. Automata modelling the Zhabotinsky reaction frequently use this technique to prolong the refractive interval of cells in the base plane.
If the entire CAM is dedicated to counting, it becomes an assemblage of four bit counters which can span the range from 0 to 15, something which can be accomplished in many ways. The most obvious is to take the bits in the order of the planes, incrementing the four bit hexadecimal digit derived thereby in the accustomed fashion. Apart from permuting the bits, there are other sequences such as the Gray code which are sometimes useful. Any of these counters can be installed using inhx with a suitable argument.
If a counter is to be combined with the evolution of a Moore automaton in plane 0, only three bits remain for a counter, restricting its range to 8. A similar range is available to a (2,1) von Neumann automaton in plane 0, but only a two bit counter with a range of 4 is available to a (4,1) von Neumann automaton occupying planes 0 and 1.
The subroutine inzh() installs the Moore neighborhood, 3-bit Zhabotinsky rule, calling zhatobin(t,i,j,p2,p3) in the process. This latter subroutine uses the global variable zhtbl[a0][g][n] to construct a rule table int *t suitable for use in plane j+2*i) when the center cells in the opposite CAM are p2 and p3.
Meanwhile, a0 is the cell in plane 0, which can be either infectious or not , in generation g when surrounded by n infectious neighbors; editing zhtbl is an option accessible through the menu f1.