Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Incorrect

200Size
Leading solution size is 0.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
assignin('caller','score',200);

                    
2
Fail
 
%%
[mcell] = Life;
[nr,nc]=size(mcell);
% check for uniqueness
valid=1;
tic
for k=1:nc-1
  mk=mcell{k};
 for p=k+1:nc
  mp=mcell{p};
  mkp=mk==mp;
  if all(mkp(:))
   valid=0;
  end
 end
end
assert(valid==1,sprintf('Not all unique solutions'));
toc
% run an evolution and verify
tic
for k=1:nc
  m=mcell{k};
  m=[zeros(1,6);zeros(4,1) m zeros(4,1);zeros(1,6)];
  mc=conv2(m,[1 1 1;1 0 1;1 1 1],'same');
  m=~(mc<2 | mc>3) & ((m & mc==2) | (m & mc==3) | (~m & mc==3));
  assert(isequal(nnz(m),1),sprintf('Non-Single survivor solution'))
end
toc
assignin('caller','score',min(200,max(0,600-nc)));
Error: The right hand side of this assignment has too few values to satisfy the left hand side.