Problem 52. What is the next step in Conway's Life?
Solution Stats
Problem Comments

6 Comments
I think test sets should be designed to encourage general solutions. At present, the test set only has square boards  some more varied examples would make solvers seek code that is general.
Is there something wrong with the test suite? function B = life(A) B = A; end produces "Error using life Too many output arguments." See comment on solution 1019804.
I suppose the error "Error using life Too many output arguments." is due to shadowing. It seems thet test suite calls \toolbox\matlab\demos\life.m
I had so much fun with this problem. Thank you.
Is there a syntax flaw in the Test Suite? Currently the first test displays with a first line of "%%A = [ ...", and in my solution (S 1435695) only the second test is displayed. Although apparently the first test is still being called (S 1435709)?
Game of life is soo cool!
Solution Comments

1 Comment
Is there something wrong with the test suite?
function B = life(A)
B = A;
end
produces "Error using life Too many output arguments."

1 Comment
This solution is for only a 4x4 A. See Solution 598430 for general solution.

1 Comment
This is the solution for A of any size.

1 Comment
Ties the current leader in size, but works on all board sizes.

1 Comment
This stops working if the input is not 4x4.

1 Comment
Nice way of expanding A for circular convolution

1 Comment
Humph! Solution 2234 uses imfilter, but this fails with imfilter not found!

1 Comment
Nice  but only works for 4x4 boards.

1 Comment
Puzzling  solution 2231 uses imfilter but this solution fails because padarray isn't available. Both are in the IPT.

2 Comments
Nice usage of a simpler matrix for convolution (ones(3)) and readjustment of the logical conditions.
Good job!

3 Comments
I was looking for a command to do a circular convolution, but couldn't figure it out. This is useful to learn and, I guess, the whole point of Cody
However, learning is severely hindered by not being able to view solutions of smaller size. At least, as far as i know, this is not possible.
_All_ solutions in this Problem will become viewable after you solve _another_ Problem in the same category (which here is "Cody Challenge").
Problem Recent Solvers1106
Suggested Problems

Remove the two elements next to NaN value
609 Solvers

Convert from Base 10 to base 5
245 Solvers

Multiples of a Number in a Given Range
498 Solvers

Generate a random matrix A of (1,1)
249 Solvers

Find the sides of an isosceles triangle when given its area and height from its base to apex
1377 Solvers
More from this Author96
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!