Cody

Solution 2097655

Submitted on 18 Jan 2020 by William
  • Size: 178
  • This is the leading solution.
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))

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))

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))

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)))

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))

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))

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))

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))

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))