Cody

# Problem 45269. Game of life - 01

Solution 2170247

Submitted on 22 Mar 2020 by Nikolaos Nikolaou
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
n=1; A =[1 0 0 0;0 1 0 0;0 0 1 0;1 0 0 1]; y_correct = 1; assert(isequal(gameOfLife_3(A,n),y_correct))

out = 1

2   Pass
n=10; A =[1 0 0 0;0 1 0 0;0 0 1 0;1 0 0 1]; y_correct = 1; assert(isequal(gameOfLife_3(A,n),y_correct))

out = 1

3   Pass
n=5; A =[1 0 0 1;0 0 0 0;0 0 0 0;1 0 0 1]; y_correct =[1,2,3,4,5] ; assert(isequal(gameOfLife_3(A,n),y_correct))

out = 1 2 3 4 5

4   Pass
n=10; A =[1 0 0 1;0 1 1 0;0 1 1 0;1 0 0 1]; assert(isempty(gameOfLife_3(A,n)))

out = 1 2 3 4 5 6 7 8 9 10 out = []

5   Pass
n=10; A = [ ... 1 1 0 0 0 1 0 0 1 1 0 0 0 0 0 0]; y_correct = [1,3,4,5,7,8,9]; assert(isequal(gameOfLife_3(A,n),y_correct))

out = 1 3 4 5 7 8 9

6   Pass
n=15; A = [ ... 0 1 1 0 1 1 1 0 0 0 1 0 0 0 0 0]; y_correct = 3; assert(isequal(gameOfLife_3(A,n),y_correct))

out = 3

7   Pass
n=8; A =[0 0 0 0;0 0 0 1;0 0 0 1;0 1 1 1]; y_correct = 2; assert(isequal(gameOfLife_3(A,n),y_correct))

out = 2

8   Pass
n=20; A =[0 0 0 0 0 0;1 0 0 1 0 0;0 0 0 1 0 0;0 1 0 0 0 1;1 0 1 0 1 0]; y_correct = 1; assert(isequal(gameOfLife_3(A,n),y_correct))

out = 1

9   Pass
n=15; A=[0 0 0 0 0 0;1 0 0 1 0 0;0 0 0 1 0 0;0 1 0 0 0 1;1 0 1 0 1 0;0 0 0 1 1 1;0 1 0 0 0 0]; y_correct = 1; assert(isequal(gameOfLife_3(A,n),y_correct))

out = 1