Define an extra array which is used for display. In this array keep track of which generation (modulo 256) that the cell was born. This array can be used for a colour display and so the age of the cell can be seen. To print out this colour array, change the header statement from
WRITE(10,fmt='(''P2'',/,I3,2X,I3,/,I3)') N, N, 1
to
WRITE(10,fmt='(''P2'',/,I3,2X,I3,/,I3)') N, N, 255