Cody

Solution 1818901

Submitted on 17 May 2019
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   Fail
b = [0 1 1 0 2; 0 1 2 2 1; 1 0 2 2 2; 1 1 2 2 1; 1 1 2 1 0]; result_correct = 2; assert(isequal(c4winner(b),result_correct))

Error using ismember>ismemberR2012a (line 212) Inputs A and B must be matrices with the same number of columns in the 'rows' case. Error in ismember (line 146) lia = ismemberR2012a(A,B,logical(flaginds(1))); Error in c4winner (line 3) Win(p,1)=ismember ([p,p,p,p], b, 'rows') %check rows Error in Test1 (line 7) assert(isequal(c4winner(b),result_correct))

2   Fail
b = [0 0 0 0; 1 0 2 0; 1 1 1 1; 0 0 2 2]; result_correct = 1; assert(isequal(c4winner(b),result_correct))

Win = logical 1

Error using ismember>ismemberR2012a (line 212) Inputs A and B must be matrices with the same number of columns in the 'rows' case. Error in ismember (line 146) lia = ismemberR2012a(A,B,logical(flaginds(1))); Error in c4winner (line 4) Win(p,2)=ismember ([p,p,p,p]', b', 'rows') %check columns Error in Test2 (line 6) assert(isequal(c4winner(b),result_correct))

3   Fail
b = [0 0 0 0 0 1; 2 2 0 0 2 2; 0 0 0 0 0 1; 2 0 0 1 1 0; 0 0 0 1 0 0; 0 0 1 0 2 2]; result_correct = 1; assert(isequal(c4winner(b),result_correct))

Error using ismember>ismemberR2012a (line 212) Inputs A and B must be matrices with the same number of columns in the 'rows' case. Error in ismember (line 146) lia = ismemberR2012a(A,B,logical(flaginds(1))); Error in c4winner (line 3) Win(p,1)=ismember ([p,p,p,p], b, 'rows') %check rows Error in Test3 (line 8) assert(isequal(c4winner(b),result_correct))

4   Fail
b = [0 0 0 0; 1 0 0 0; 0 0 0 0; 0 0 0 2]; result_correct = 0; assert(isequal(c4winner(b),result_correct))

Win = logical 0

Error using ismember>ismemberR2012a (line 212) Inputs A and B must be matrices with the same number of columns in the 'rows' case. Error in ismember (line 146) lia = ismemberR2012a(A,B,logical(flaginds(1))); Error in c4winner (line 4) Win(p,2)=ismember ([p,p,p,p]', b', 'rows') %check columns Error in Test4 (line 6) assert(isequal(c4winner(b),result_correct))

5   Fail
b = [0 0 0 0; 1 1 1 1; 0 0 0 0; 0 0 0 2]; result_correct = 1; assert(isequal(c4winner(b),result_correct))

Win = logical 1

Error using ismember>ismemberR2012a (line 212) Inputs A and B must be matrices with the same number of columns in the 'rows' case. Error in ismember (line 146) lia = ismemberR2012a(A,B,logical(flaginds(1))); Error in c4winner (line 4) Win(p,2)=ismember ([p,p,p,p]', b', 'rows') %check columns Error in Test5 (line 6) assert(isequal(c4winner(b),result_correct))

6   Fail
b = [0 0 2 2; 1 0 2 0; 1 2 2 1; 2 0 1 2]; result_correct = 2; assert(isequal(c4winner(b),result_correct))

Win = logical 0

Error using ismember>ismemberR2012a (line 212) Inputs A and B must be matrices with the same number of columns in the 'rows' case. Error in ismember (line 146) lia = ismemberR2012a(A,B,logical(flaginds(1))); Error in c4winner (line 4) Win(p,2)=ismember ([p,p,p,p]', b', 'rows') %check columns Error in Test6 (line 6) assert(isequal(c4winner(b),result_correct))

7   Fail
b = [0 0 0 0; 1 0 1 1; 0 0 2 0; 0 2 0 2]; result_correct = 0; assert(isequal(c4winner(b),result_correct))

Win = logical 0

Error using ismember>ismemberR2012a (line 212) Inputs A and B must be matrices with the same number of columns in the 'rows' case. Error in ismember (line 146) lia = ismemberR2012a(A,B,logical(flaginds(1))); Error in c4winner (line 4) Win(p,2)=ismember ([p,p,p,p]', b', 'rows') %check columns Error in Test7 (line 6) assert(isequal(c4winner(b),result_correct))