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)?
Thank you! see u soon!
function B = gameOfLife(A)
if C(i,j)==1 %该细胞现在存活
Is there something wrong with the test suite?
function B = life(A)
B = A;
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.
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 Goldbach Conjecture, Part 2
Back to basics 8 - Matrix Diagonals
Scoring for oriented dominoes
middleAsColumn: Return all but first and last element as a column vector
Pi Digit Probability
Connect Four Win Checker
Which doors are open?
Counting in Finnish
Word Counting and Indexing
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office