Cody

Solution 408693

Submitted on 24 Feb 2014 by Axel
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))

ans = Columns 1 through 16 0 1 4 12 38 33 18 54 0 1 1 0 2 0 0 0 0 1 5 17 52 75 63 27 0 4 5 2 7 0 0 0 1 3 11 35 26 78 72 54 1 12 17 8 23 0 0 0 1 4 14 44 52 75 63 27 4 37 53 26 70 0 0 0 1 4 14 43 48 63 27 0 13 31 80 79 48 0 0 0 0 0 0 0 0 0 0 0 39 12 78 75 63 0 0 0 0 0 0 0 0 0 0 0 36 36 72 63 27 0 0 0 0 0 0 0 0 0 0 0 27 27 54 27 0 0 0 0 Columns 17 through 32 0 1 1 0 2 0 0 0 0 0 0 0 1 1 0 2 0 1 5 5 1 6 0 0 0 0 0 3 4 2 8 1 1 0 5 17 17 3 18 0 0 0 9 13 6 26 5 2 1 4 2 17 52 51 9 54 0 27 39 19 79 17 8 1 1 4 14 7 51 75 72 27 0 36 57 76 52 26 4 0 0 3 12 42 21 72 63 54 27 9 66 75 78 12 0 0 0 0 9 36 45 63 54 27 27 36 63 72 36 0 0 0 0 0 0 27 27 54 27 0 27 27 54 27 0 0 0 0 ans = 2

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

ans = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 3 11 33 18 54 0 0 1 0 2 0 0 0 0 0 1 4 13 40 39 36 27 0 4 1 7 1 0 0 0 0 0 0 2 8 24 72 54 0 12 3 23 5 0 0 0 0 0 0 0 0 0 0 0 0 36 9 69 15 0 0 0 0 0 0 0 0 0 0 0 0 27 27 45 45 0 0 0 0 0 0 0 0 0 0 0 0 0 0 54 54 0 0 0 0 Columns 17 through 31 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 2 0 0 0 0 0 0 0 0 1 0 2 0 1 4 1 7 0 0 0 0 0 0 3 1 7 1 1 0 3 14 5 21 0 0 0 0 9 3 21 3 5 2 0 0 9 42 15 63 0 0 27 9 63 9 15 6 0 0 0 0 27 45 45 27 0 27 27 27 45 18 0 0 0 0 0 0 0 54 54 0 0 0 54 54 0 0 0 ans = 1

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

ans = Columns 1 through 16 0 0 0 0 0 1 3 9 27 0 0 0 0 1 0 0 2 8 24 72 56 8 24 72 56 2 0 0 2 5 0 0 0 0 0 0 0 1 3 9 33 6 0 0 6 16 0 0 2 6 18 55 4 12 36 27 20 18 0 1 19 48 0 0 0 0 0 1 3 9 27 0 60 54 0 4 57 63 0 0 0 0 1 3 11 35 24 72 72 0 1 12 11 29 0 0 0 0 0 0 0 0 0 0 54 0 3 36 33 6 0 0 0 0 0 0 0 0 0 0 0 0 9 27 18 18 0 0 0 0 0 0 0 0 0 0 0 0 27 0 54 54 0 0 Columns 17 through 32 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 2 2 0 0 2 2 3 0 0 0 0 2 2 0 0 5 0 6 6 0 0 7 6 9 0 0 6 6 0 0 15 6 2 0 18 19 1 0 21 18 27 18 18 2 0 45 19 4 0 6 0 55 57 3 0 63 108 54 6 0 54 57 13 0 0 0 19 0 5 11 9 0 27 18 0 0 9 40 0 2 0 0 0 57 0 15 33 27 54 0 0 27 39 0 6 6 0 0 0 0 9 0 45 18 0 0 0 36 0 18 18 0 0 0 0 0 0 27 0 54 54 0 27 0 54 54 0 0 Column 33 1 2 1 0 0 2 0 0 0 ans = 1

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

ans = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 3 9 27 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 2 6 18 54 0 9 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 27 0 0 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 54 0 0 0 0 Columns 17 through 31 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 3 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 9 2 0 0 0 0 0 9 0 0 0 0 2 0 0 0 27 6 0 0 0 27 0 0 0 0 6 0 0 0 0 0 0 18 0 0 0 0 0 0 18 0 0 0 0 0 0 0 0 54 0 0 0 0 54 0 0 0 ans = 0

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

ans = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 4 13 40 39 36 27 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 3 3 3 3 0 0 0 0 0 0 0 2 6 18 54 0 9 9 9 11 0 0 0 0 0 0 0 0 0 0 0 0 27 27 27 33 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 54 0 0 0 0 Columns 17 through 31 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 0 3 3 3 3 0 0 0 0 0 3 3 3 3 0 0 0 9 11 9 9 0 0 0 9 9 9 9 0 2 0 0 0 27 33 27 27 0 27 27 27 27 0 6 0 0 0 0 0 0 18 0 0 0 0 0 0 18 0 0 0 0 0 0 0 0 54 0 0 0 0 54 0 0 0 ans = 1

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

ans = Columns 1 through 16 0 0 2 8 24 72 54 0 0 0 2 2 0 0 0 0 1 3 11 33 18 54 0 0 1 0 8 6 0 0 0 0 1 5 17 52 75 63 27 0 4 2 26 19 0 0 0 0 2 6 19 59 15 45 54 0 14 6 79 59 0 0 0 0 0 0 0 0 0 0 0 0 42 18 75 15 0 0 0 0 0 0 0 0 0 0 0 0 45 54 63 45 0 0 0 0 0 0 0 0 0 0 0 0 54 0 27 54 0 0 0 0 Columns 17 through 31 0 0 2 2 0 0 0 0 0 0 0 0 0 2 2 1 0 2 6 6 0 0 0 0 0 0 1 6 8 0 1 5 2 7 18 18 0 0 0 0 3 19 26 2 1 2 3 16 8 21 54 54 0 0 9 57 80 6 4 2 0 6 9 48 24 63 0 0 27 9 78 18 12 6 0 0 0 18 27 63 72 27 0 27 72 54 36 18 0 0 0 0 0 54 0 27 54 0 54 0 27 54 0 0 0 ans = 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))

ans = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 3 10 31 12 36 27 0 1 0 1 1 0 0 0 0 0 0 2 6 18 54 0 0 3 0 5 3 0 0 0 0 0 2 6 20 60 18 54 0 9 2 15 11 0 0 0 0 0 0 0 0 0 0 0 0 27 6 45 33 0 0 0 0 0 0 0 0 0 0 0 0 0 18 54 18 0 0 0 0 0 0 0 0 0 0 0 0 0 54 0 54 0 0 0 0 Columns 17 through 31 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 1 0 1 1 0 3 2 3 3 0 0 0 0 0 3 0 3 5 0 0 2 9 8 9 9 0 0 0 9 0 9 17 0 2 0 0 6 27 24 27 27 0 27 0 27 51 0 6 0 0 0 0 18 0 72 0 0 0 0 72 0 18 0 0 0 0 0 0 54 0 54 0 0 54 0 54 0 0 0 ans = 0