1. Any live cell with fewer than two live neighbors dies, as if caused by under-population. 2. Any live cell with two or three live neighbors lives on to the next generation. 3. Any live cell with more than three live neighbors dies, as if by overcrowding. 4. Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction. 5. No wrap around. Beyond edge is zero. Eight Neighbors.
Determine the period of life for a given binary matrix. A stable configuration, Still Life, has a cycle of 1.
Input: M , an [m,n] array
Output: N, Period of Life cycle (Period <11)
Examples: A few matrices of varying periods
N=1 N=2 N=3 Caterer 0000 00000 0000000000 0110 00000 0001000000 0110 01110 0100011110 0000 00000 0100010000 00000 0100000000 0000100000 0011000000 0000000000
MATLAB and Simulink resources for Arduino, LEGO, and Raspberry PiLearn more
Opportunities for recent engineering grads.Apply Today
New to MATLAB?Learn MATLAB today!
Play games and win prizes!Learn more