Cody

Problem 45355. Connect Four - 03

Solution 3486494

Submitted on 30 Oct 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   Pass
x = [ 1 1 1 1 1 1 1 1; 2 2 2 2 2 2 2 2; 2 1 2 1 2 1 2 1; 1 2 1 2 1 2 1 2; 2 1 2 1 2 1 2 1; 1 2 1 2 1 2 1 1]; assert(isequal(connect_four_2(x),2))

a = 0×1 empty double column vector b = 0×1 empty double column vector

2   Pass
x = [ 1 1 1 1 1 1 1 1; 2 2 2 2 2 2 2 2; 2 1 2 1 0 1 2 1; 1 2 1 2 1 2 1 2; 2 1 2 1 2 1 2 1; 1 2 1 2 1 2 1 1]; assert(isequal(connect_four_2(x),'invalid'))

a = 2 b = 5

3   Pass
x = [ 1 1 1 1 1 1 1 1 2; 2 2 2 2 2 2 2 2 1; 2 1 2 1 2 1 2 1 2; 1 2 1 2 1 2 1 2 2; 2 1 2 1 2 1 2 1 2; 1 2 1 2 1 2 1 1 2]; assert(isequal(connect_four_2(x),2))

a = 0×1 empty double column vector b = 0×1 empty double column vector

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

a = 0×1 empty double column vector b = 0×1 empty double column vector

Assertion failed.

5   Pass
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_2(x),0))

a = 0×1 empty double column vector b = 0×1 empty double column vector

6   Pass
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 1 1 1 1 1 1 1 1]; assert(isequal(connect_four_2(x),1))

a = 0×1 empty double column vector b = 0×1 empty double column vector

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!