Cody

# Problem 90. Connect Four Win Checker

Solution 1977950

Submitted on 15 Oct 2019 by Alvin LAU
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
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))

result = 0 f = 0 1 1 0 0 1 2 2 1 0 2 2 1 1 2 2 f = 1 1 0 2 1 2 2 1 0 2 2 2 1 2 2 1 f = 0 1 2 2 1 0 2 2 1 1 2 2 1 1 2 1 f = 1 2 2 1 0 2 2 2 1 2 2 1 1 2 1 0 result = 2 f = 0 1 1 0 0 1 2 2 1 0 2 2 1 1 2 2 f = 1 1 0 2 1 2 2 1 0 2 2 2 1 2 2 1 f = 0 1 2 2 1 0 2 2 1 1 2 2 1 1 2 1 f = 1 2 2 1 0 2 2 2 1 2 2 1 1 2 1 0

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

result = 0 result = 1 f = 0 0 0 0 1 0 2 0 1 1 1 1 0 0 2 2 f = 0 0 0 0 1 0 2 0 1 1 1 1 0 0 2 2

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

result = 0 f = 0 0 0 0 2 2 0 0 0 0 0 0 2 0 0 1 f = 0 0 0 0 2 0 0 2 0 0 0 0 0 0 1 1 f = 0 0 0 1 0 0 2 2 0 0 0 1 0 1 1 0 f = 2 2 0 0 0 0 0 0 2 0 0 1 0 0 0 1 f = 2 0 0 2 0 0 0 0 0 0 1 1 0 0 1 0 f = 0 0 2 2 0 0 0 1 0 1 1 0 0 1 0 0 f = 0 0 0 0 2 0 0 1 0 0 0 1 0 0 1 0 f = 0 0 0 0 0 0 1 1 0 0 1 0 0 1 0 2 f = 0 0 0 1 0 1 1 0 0 1 0 0 1 0 2 2 result = 1 f = 0 0 0 0 2 2 0 0 0 0 0 0 2 0 0 1 f = 0 0 0 0 2 0 0 2 0 0 0 0 0 0 1 1 f = 0 0 0 1 0 0 2 2 0 0 0 1 0 1 1 0 f = 2 2 0 0 0 0 0 0 2 0 0 1 0 0 0 1 f = 2 0 0 2 0 0 0 0 0 0 1 1 0 0 1 0 f = 0 0 2 2 0 0 0 1 0 1 1 0 0 1 0 0 f = 0 0 0 0 2 0 0 1 0 0 0 1 0 0 1 0 f = 0 0 0 0 0 0 1 1 0 0 1 0 0 1 0 2 f = 0 0 0 1 0 1 1 0 0 1 0 0 1 0 2 2

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

result = 0 f = 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 2 f = 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 2

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

result = 0 result = 1 f = 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 2 f = 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 2

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

result = 0 f = 0 0 2 2 1 0 2 0 1 2 2 1 2 0 1 2 f = 0 0 2 2 1 0 2 0 1 2 2 1 2 0 1 2 result = 2

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

result = 0 f = 0 0 0 0 1 0 1 1 0 0 2 0 0 2 0 2 f = 0 0 0 0 1 0 1 1 0 0 2 0 0 2 0 2