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)?
Is there something wrong with the test suite?
function B = life(A)
B = A;
end
produces "Error using life Too many output arguments."
This solution is for only a 4x4 A. See Solution 598430 for general solution.
This is the solution for A of any size.
Ties the current leader in size, but works on all board sizes.
This stops working if the input is not 4x4.
Nice way of expanding A for circular convolution
Humph! Solution 2234 uses imfilter, but this fails with imfilter not found!
Nice - but only works for 4x4 boards.
Puzzling - solution 2231 uses imfilter but this solution fails because padarray isn't available. Both are in the IPT.
Nice usage of a simpler matrix for convolution (ones(3)) and readjustment of the logical conditions.
Good job!
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").
The Hitchhiker's Guide to MATLAB
2978 Solvers
middleAsColumn: Return all but first and last element as a column vector
458 Solvers
561 Solvers
1580 Solvers
597 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!