Cody

Solution 318176

Submitted on 12 Sep 2013 by Sky Sartorius
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
list = {[1 3; 2 4; 5 6],[4 6; 2 5;6 7],[3 4; 6 1; 4 6]} selections = [2 1 2]; assert(isequal(ChooseBestFittingDominoes(list),selections))

list = [3x2 double] [3x2 double] [3x2 double] s = 4 s = 4 1 s = 4 1 3 s = 4 1 3 3 s = 4 1 3 3 2 s = 4 1 3 3 2 2 s = 4 1 3 3 2 2 7 s = 4 1 3 3 2 2 7 4 s = 4 1 3 3 2 2 7 4 6 s = 4 1 3 3 2 2 7 4 6 3 s = 4 1 3 3 2 2 7 4 6 3 0 s = 4 1 3 3 2 2 7 4 6 3 0 2 s = 4 1 3 3 2 2 7 4 6 3 0 2 4 s = 4 1 3 3 2 2 7 4 6 3 0 2 4 3 s = 4 1 3 3 2 2 7 4 6 3 0 2 4 3 3 s = 4 1 3 3 2 2 7 4 6 3 0 2 4 3 3 6 s = Columns 1 through 16 4 1 3 3 2 2 7 4 6 3 0 2 4 3 3 6 Column 17 3 s = Columns 1 through 16 4 1 3 3 2 2 7 4 6 3 0 2 4 3 3 6 Columns 17 through 18 3 5 s = Columns 1 through 16 4 1 3 3 2 2 7 4 6 3 0 2 4 3 3 6 Columns 17 through 19 3 5 5 s = Columns 1 through 16 4 1 3 3 2 2 7 4 6 3 0 2 4 3 3 6 Columns 17 through 20 3 5 5 2 s = Columns 1 through 16 4 1 3 3 2 2 7 4 6 3 0 2 4 3 3 6 Columns 17 through 21 3 5 5 2 4 s = Columns 1 through 16 4 1 3 3 2 2 7 4 6 3 0 2 4 3 3 6 Columns 17 through 22 3 5 5 2 4 6 s = Columns 1 through 16 4 1 3 3 2 2 7 4 6 3 0 2 4 3 3 6 Columns 17 through 23 3 5 5 2 4 6 5 s = Columns 1 through 16 4 1 3 3 2 2 7 4 6 3 0 2 4 3 3 6 Columns 17 through 24 3 5 5 2 4 6 5 5 s = Columns 1 through 16 4 1 3 3 2 2 7 4 6 3 0 2 4 3 3 6 Columns 17 through 25 3 5 5 2 4 6 5 5 4 s = Columns 1 through 16 4 1 3 3 2 2 7 4 6 3 0 2 4 3 3 6 Columns 17 through 26 3 5 5 2 4 6 5 5 4 1 s = Columns 1 through 16 4 1 3 3 2 2 7 4 6 3 0 2 4 3 3 6 Columns 17 through 27 3 5 5 2 4 6 5 5 4 1 3 i = 11 ans = 2 1 2

2   Pass
%% list = {[1 5; 2 3; 2 2; 3 4; 0 3], [0 4; 1 5; 2 2; 4 5; 4 6], [7 7; 3 8; 4 7; 5 9; 0 4]}; selections = [4 4 4]; assert(isequal(ChooseBestFittingDominoes(list),selections))

s = 8 s = 8 6 s = 8 6 5 s = 8 6 5 6 s = 8 6 5 6 9 s = 8 6 5 6 9 6 s = 8 6 5 6 9 6 6 s = 8 6 5 6 9 6 6 5 s = 8 6 5 6 9 6 6 5 4 s = 8 6 5 6 9 6 6 5 4 9 s = 8 6 5 6 9 6 6 5 4 9 8 s = 8 6 5 6 9 6 6 5 4 9 8 4 s = 8 6 5 6 9 6 6 5 4 9 8 4 5 s = 8 6 5 6 9 6 6 5 4 9 8 4 5 6 s = 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 s = 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Column 17 3 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 18 3 2 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 19 3 2 1 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 20 3 2 1 6 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 21 3 2 1 6 2 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 22 3 2 1 6 2 4 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 23 3 2 1 6 2 4 3 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 24 3 2 1 6 2 4 3 2 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 25 3 2 1 6 2 4 3 2 7 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 26 3 2 1 6 2 4 3 2 7 6 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 27 3 2 1 6 2 4 3 2 7 6 4 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 28 3 2 1 6 2 4 3 2 7 6 4 3 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 29 3 2 1 6 2 4 3 2 7 6 4 3 4 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 30 3 2 1 6 2 4 3 2 7 6 4 3 4 7 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 31 3 2 1 6 2 4 3 2 7 6 4 3 4 7 4 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 32 3 2 1 6 2 4 3 2 7 6 4 3 4 7 4 4 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 32 3 2 1 6 2 4 3 2 7 6 4 3 4 7 4 4 Column 33 3 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 32 3 2 1 6 2 4 3 2 7 6 4 3 4 7 4 4 Columns 33 through 34 3 2 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 32 3 2 1 6 2 4 3 2 7 6 4 3 4 7 4 4 Columns 33 through 35 3 2 7 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 32 3 2 1 6 2 4 3 2 7 6 4 3 4 7 4 4 Columns 33 through 36 3 2 7 6 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 32 3 2 1 6 2 4 3 2 7 6 4 3 4 7 4 4 Columns 33 through 37 3 2 7 6 2 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 32 3 2 1 6 2 4 3 2 7 6 4 3 4 7 4 4 Columns 33 through 38 3 2 7 6 2 3 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 32 3 2 1 6 2 4 3 2 7 6 4 3 4 7 4 4 Columns 33 through 39 3 2 7 6 2 3 4 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 32 3 2 1 6 2 4 3 2 7 6 4 3 4 7 4 4 Columns 33 through 40 3 2 7 6 2 3 4 3 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 32 3 2 1 6 2 4 3 2 7 6 4 3 4 7 4 4 Columns 33 through 41 3 2 7 6 2 3 4 3 3 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 32 3 2 1 6 2 4 3 2 7 6 4 3 4 7 4 4 Columns 33 through 42 3 2 7 6 2 3 4 3 3 3 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 32 3 2 1 6 2 4 3 2 7 6 4 3 4 7 4 4 Columns 33 through 43 3 2 7 6 2 3 4 3 3 3 2 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 32 3 2 1 6 2 4 3 2 7 6 4 3 4 7 4 4 Columns 33 through 44 3 2 7 6 2 3 4 3 3 3 2 1 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 32 3 2 1 6 2 4 3 2 7 6 4 3 4 7 4 4 Columns 33 through 45 3 2 7 6 2 3 4 3 3 3 2 1 6 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 32 3 2 1 6 2 4 3 2 7 6 4 3 4 7 4 4 Columns 33 through 46 3 2 7 6 2 3 4 3 3 3 2 1 6 2 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 32 3 2 1 6 2 4 3 2 7 6 4 3 4 7 4 4 Columns 33 through 47 3 2 7 6 2 3 4 3 3 3 2 1 6 2 4 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 32 3 2 1 6 2 4 3 2 7 6 4 3 4 7 4 4 Columns 33 through 48 3 2 7 6 2 3 4 3 3 3 2 1 6 2 4 3 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 32 3 2 1 6 2 4 3 2 7 6 4 3 4 7 4 4 Columns 33 through 48 3 2 7 6 2 3 4 3 3 3 2 1 6 2 4 3 Column 49 2 s = Columns 1 through 16 8 6 5 6 9 6 6 5 4 9 8 4 5 6 5 3 Columns 17 through 32 3 2 1 6 2 4 3 2 7 6 4 3 4 7 4 4 Columns 33 through 48 3 2 7 6 2 3 4 3 3 3 2 1 6 2 4 3 Columns 49 through 50 2 7 s =...

3   Pass
%% list = {[1 4; 2 2; 1 1; 3 3],[1 2; 2 3],[2 2]}; selections = [3 1 1]; assert(isequal(ChooseBestFittingDominoes(list),selections))

s = 3 s = 3 3 s = 3 3 1 s = 3 3 1 1 s = 3 3 1 1 0 s = 3 3 1 1 0 2 s = 3 3 1 1 0 2 2 s = 3 3 1 1 0 2 2 2 i = 5 ans = 3 1 1