Cody

Problem 45354. Connect Four - 01

Solution 2150231

Submitted on 4 Mar 2020
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
x =[2 2 1 1 2 1 2; 1 2 2 1 1 1 1; 1 2 1 1 2 2 2; 2 1 2 2 2 1 1; 1 1 2 1 2 1 1; 2 1 1 2 2 2 1]; assert(isequal(connect_four(x),1))

p = 1×1 cell array {4×4 double} idx = 4×0 empty double matrix arrfnd = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 score1 = 0 idx = 5 10 15 20 arrfnd = 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 score1 = 1 idx = 4×0 empty double matrix arrfnd = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 score1 = 1 idx = 20 26 32 38 arrfnd = 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 score1 = 2

Output argument "win" (and maybe others) not assigned during call to "connect_four". Error in Test1 (line 7) assert(isequal(connect_four(x),1))

2   Fail
x =[ 2 2 1 1 2 1 2 1 2 2 1 1 1 1 1 2 1 1 2 2 2 2 1 2 2 2 1 1 1 1 2 1 2 1 1 2 1 1 2 2 2 2]; assert(isequal(connect_four(x),0))

p = 1×1 cell array {4×4 double} idx = 4×0 empty double matrix arrfnd = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 score1 = 0 idx = 5 10 15 20 arrfnd = 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 score1 = 1 idx = 4×0 empty double matrix arrfnd = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 score1 = 1 idx = 20 26 32 38 arrfnd = 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 score1 = 2

Output argument "win" (and maybe others) not assigned during call to "connect_four". Error in Test2 (line 7) assert(isequal(connect_four(x),0))

3   Fail
x = [2 2 1 1 2 1 2 1 2 2 1 1 1 1 1 2 1 1 1 2 2 2 1 2 2 2 1 1 1 1 2 1 2 1 2 2 1 1 2 2 2 2 1 1 2 1 2 1 2]; assert(isequal(connect_four(x),1))

p = 1×1 cell array {4×4 double} idx = 15 23 31 39 arrfnd = 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 score1 = 1 idx = 5 11 17 23 arrfnd = 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 score1 = 2 idx = 11 12 13 14 arrfnd = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 score1 = 3 idx = 23 30 37 44 arrfnd = 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 score1 = 4

Output argument "win" (and maybe others) not assigned during call to "connect_four". Error in Test3 (line 8) assert(isequal(connect_four(x),1))

4   Fail
x =[2 2 1 1 2 1 2 1 1 2 2 1 1 1 1 2 1 2 1 1 1 2 2 2 2 1 2 2 2 1 1 2 1 1 2 1 2 1 2 2 2 1 1 2 2 2 2 1 1 1 2 1 2 1 2 1]; assert(isequal(connect_four(x),2))

p = 1×1 cell array {4×4 double} idx = 15 23 31 39 arrfnd = 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 score1 = 1 idx = 5 11 17 23 arrfnd = 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 score1 = 2 idx = 11 12 13 14 arrfnd = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 score1 = 3 idx = 23 30 37 44 arrfnd = 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 score1 = 4

Output argument "win" (and maybe others) not assigned during call to "connect_four". Error in Test4 (line 8) assert(isequal(connect_four(x),2))

5   Fail
x = [2 2 1 1 2 1 2 1 1 2 2 1 1 1 1 2 1 2 1 1 1 2 2 2 2 1 2 2 2 1 1 2 1 1 2 1 2 1 2 2 2 1 1 2 2 2 2 1 1 1 2 1 2 1 2 1 1 2 1 1 1 1 2 1]; assert(isequal(connect_four(x),0))

p = 1×1 cell array {4×4 double} idx = 13 17 22 26 31 35 40 44 arrfnd = 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 score1 = 2 idx = 5 8 12 15 19 22 26 29 arrfnd = 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 score1 = 4 idx = 12 13 14 15 arrfnd = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 score1 = 5 idx = 24 26 32 34 40 42 48 50 arrfnd = 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 score1 = 7

Output argument "win" (and maybe others) not assigned during call to "connect_four". Error in Test5 (line 9) assert(isequal(connect_four(x),0))

Suggested Problems

More from this Author149

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!