Cody

Problem 45355. Connect Four - 03

Solution 2176743

Submitted on 26 Mar 2020 by Binbin Qi
  • Size: 88
  • This is the leading solution.
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 Author148