/* the alarm condition table */ int table[]={ 0, 0, 1, 0, 1, 1, 1, 1, 1}; int sum; /* the variable used to accumulate neighbor density */ nbr y; /* the variable used in the scanning of neighbors */ /* The default is no change to all fields */ default value=value; default alarm=alarm; default counter=counter; /* scanning neighbors */ sum=0; over each other y: /* loop through all neighbors */ if (y:value) sum++; /* if a neighbor is active, increase sum */ /* alarm bit is set according to the density collected */ alarm=table[sum]; /* value is cleared if counter is running, otherwise it is enabled */ if (counter==0) value=1; else value=0; /* if alarm is set and the cell is active, counter starts */ if (value && alarm) counter=3; else if (counter) /* counter always counts down to zero */ counter--;