Cody

Problem 45355. Connect Four - 03

Solution 2137668

Submitted on 23 Feb 2020 by Asif Newaz
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))

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'))

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))

4   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 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1]; assert(isequal(connect_four_2(x),0))

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))

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))

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!