evaporate or proliferate, the choice is yours. but! your challenge is to find out if a cellular automaton conserves population. submissions can be written in any language.
right, here we go. for simplicity, we'll be dealing with 2D automata with 3x3 neighbourhoods and 2 states. that means cells see themselves and everything in their Moore neighbourhood, for instance:
0 1 1
1 0 1
1 1 0
and from that, they decide which state they should have in the next generation: 0 or 1. as there are 29 = 512 possible combinations of 9 cells, this means there are 2512 possible automata and that each one can be
represented by a 512-bit number. for instance, conway's game of life is 100010001000101170116000100010117011601170116177E1668000100010117011601170116177E166801170116177E1668177E16687EE8688016.
a number-conserving automaton is one in which each generation is guaranteed to preserve the "population", or number of cells which are 1, of the configuration. a trivial example is FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF00000000FFFFFFFF0000000016, in which every live cell "moves right" forever. conway's game of life, on the other hand, is not number-preserving, as the population can decrease (such as when a lone cell dies) or increase (such as from a glider gun). the population must be constant on every step for the automaton to be number-preserving.
your challenge, given a representation of a two-dimensional 2-state cellular automaton using Moore neighbourhood, is to decide whether the automaton is number-conserving. as any language is allowed, there is no fixed API.
defjam(semikibibit):tot=0whilesemikibibit:tot+=semikibibit%2semikibibit//=2far=abs(256-tot)iffar==256:return"no"eliffar==0:return"probably"eliffar>100:return"probably not"else:return"hard to tell"
post a comment