Cody

Solution 1099159

Submitted on 6 Jan 2017 by HH
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
people = 5; cardsDelt = 5; isJokerIn = 0; [dealtDeck, deckLeftover] = Poker_Deal(people ,cardsDelt ,isJokerIn) deckCheck = {'2h'; '3h'; '4h'; '5h'; '6h'; '7h'; '8h'; '9h'; '10h'; 'jh'; 'qh'; 'kh'; 'ah'; '2d'; '3d'; '4d'; '5d'; '6d'; '7d'; '8d'; '9d'; '10d'; 'jd'; 'qd'; 'kd'; 'ad'; '2s'; '3s'; '4s'; '5s'; '6s'; '7s'; '8s'; '9s'; '10s'; 'js'; 'qs'; 'ks'; 'as'; '2c'; '3c'; '4c'; '5c'; '6c'; '7c'; '8c'; '9c'; '10c'; 'jc'; 'qc'; 'kc'; 'ac'} h = (sum(sum(ismember(deckCheck,dealtDeck))) == 25) & ~issorted(reshape(dealtDeck,25,1)); g = (sum(ismember(deckCheck,deckLeftover)) == (52-25)) & ~issorted(deckLeftover); y_correct = g&h; assert(isequal(g,h))

dealtDeck = 5×5 cell array 'jc' '3d' 'jh' 'as' '8h' '9d' 'kc' '3c' 'kd' '10d' '6s' 'ac' '7d' '5h' '2d' 'ad' '5d' '4c' '9c' '10s' '3h' 'qs' '8s' 'qh' '10c' deckLeftover = 1×27 cell array Columns 1 through 12 '6h' '2s' '2h' '7h' 'ks' '8d' 'kh' '8c' '9h' '7c' '6c' 'qd' Columns 13 through 24 'qc' '4h' '7s' '10h' 'jd' '2c' '4d' '4s' 'js' 'ah' '3s' '6d' Columns 25 through 27 '5c' '9s' '5s' deckCheck = 52×1 cell array '2h' '3h' '4h' '5h' '6h' '7h' '8h' '9h' '10h' 'jh' 'qh' 'kh' 'ah' '2d' '3d' '4d' '5d' '6d' '7d' '8d' '9d' '10d' 'jd' 'qd' 'kd' 'ad' '2s' '3s' '4s' '5s' '6s' '7s' '8s' '9s' '10s' 'js' 'qs' 'ks' 'as' '2c' '3c' '4c' '5c' '6c' '7c' '8c' '9c' '10c' 'jc' 'qc' 'kc' 'ac'

2   Pass
people = 3; cardsDelt = 5; isJokerIn = 0; [dealtDeck, deckLeftover] = Poker_Deal(people ,cardsDelt ,isJokerIn) deckCheck = {'2h'; '3h'; '4h'; '5h'; '6h'; '7h'; '8h'; '9h'; '10h'; 'jh'; 'qh'; 'kh'; 'ah'; '2d'; '3d'; '4d'; '5d'; '6d'; '7d'; '8d'; '9d'; '10d'; 'jd'; 'qd'; 'kd'; 'ad'; '2s'; '3s'; '4s'; '5s'; '6s'; '7s'; '8s'; '9s'; '10s'; 'js'; 'qs'; 'ks'; 'as'; '2c'; '3c'; '4c'; '5c'; '6c'; '7c'; '8c'; '9c'; '10c'; 'jc'; 'qc'; 'kc'; 'ac'} h = (sum(sum(ismember(deckCheck,dealtDeck))) == 15) & ~issorted(reshape(dealtDeck,15,1)); g = (sum(ismember(deckCheck,deckLeftover)) == (52-15)) & ~issorted(deckLeftover); y_correct = g&h; assert(isequal(g,h))

dealtDeck = 3×5 cell array 'jc' 'ad' 'kc' 'qs' '7d' '9d' '3h' 'ac' 'jh' '4c' '6s' '3d' '5d' '3c' '8s' deckLeftover = 1×37 cell array Columns 1 through 12 'as' 'kd' '5h' '9c' 'qh' '8h' '10d' '2d' '10s' '10c' '6h' '2s' Columns 13 through 24 '2h' '7h' 'ks' '8d' 'kh' '8c' '9h' '7c' '6c' 'qd' 'qc' '4h' Columns 25 through 36 '7s' '10h' 'jd' '2c' '4d' '4s' 'js' 'ah' '3s' '6d' '5c' '9s' Column 37 '5s' deckCheck = 52×1 cell array '2h' '3h' '4h' '5h' '6h' '7h' '8h' '9h' '10h' 'jh' 'qh' 'kh' 'ah' '2d' '3d' '4d' '5d' '6d' '7d' '8d' '9d' '10d' 'jd' 'qd' 'kd' 'ad' '2s' '3s' '4s' '5s' '6s' '7s' '8s' '9s' '10s' 'js' 'qs' 'ks' 'as' '2c' '3c' '4c' '5c' '6c' '7c' '8c' '9c' '10c' 'jc' 'qc' 'kc' 'ac'

3   Pass
people = 4; cardsDelt = 7; isJokerIn = 0; [dealtDeck, deckLeftover] = Poker_Deal(people ,cardsDelt ,isJokerIn) deckCheck = {'2h'; '3h'; '4h'; '5h'; '6h'; '7h'; '8h'; '9h'; '10h'; 'jh'; 'qh'; 'kh'; 'ah'; '2d'; '3d'; '4d'; '5d'; '6d'; '7d'; '8d'; '9d'; '10d'; 'jd'; 'qd'; 'kd'; 'ad'; '2s'; '3s'; '4s'; '5s'; '6s'; '7s'; '8s'; '9s'; '10s'; 'js'; 'qs'; 'ks'; 'as'; '2c'; '3c'; '4c'; '5c'; '6c'; '7c'; '8c'; '9c'; '10c'; 'jc'; 'qc'; 'kc'; 'ac'} h = (sum(sum(ismember(deckCheck,dealtDeck))) == 28) & ~issorted(reshape(dealtDeck,28,1)); g = (sum(ismember(deckCheck,deckLeftover)) == (52-28)) & ~issorted(deckLeftover); y_correct = g&h; assert(isequal(g,h))

dealtDeck = 4×7 cell array 'jc' '3h' '5d' '7d' 'kd' '8h' '10c' '9d' '3d' 'qs' '4c' '5h' '10d' '6h' '6s' 'kc' 'jh' '8s' '9c' '2d' '2s' 'ad' 'ac' '3c' 'as' 'qh' '10s' '2h' deckLeftover = 1×24 cell array Columns 1 through 12 '7h' 'ks' '8d' 'kh' '8c' '9h' '7c' '6c' 'qd' 'qc' '4h' '7s' Columns 13 through 24 '10h' 'jd' '2c' '4d' '4s' 'js' 'ah' '3s' '6d' '5c' '9s' '5s' deckCheck = 52×1 cell array '2h' '3h' '4h' '5h' '6h' '7h' '8h' '9h' '10h' 'jh' 'qh' 'kh' 'ah' '2d' '3d' '4d' '5d' '6d' '7d' '8d' '9d' '10d' 'jd' 'qd' 'kd' 'ad' '2s' '3s' '4s' '5s' '6s' '7s' '8s' '9s' '10s' 'js' 'qs' 'ks' 'as' '2c' '3c' '4c' '5c' '6c' '7c' '8c' '9c' '10c' 'jc' 'qc' 'kc' 'ac'

4   Pass
people = 5; cardsDelt = 6; isJokerIn = 1; [dealtDeck, deckLeftover] = Poker_Deal(people ,cardsDelt ,isJokerIn) deckCheck = {'2h'; '3h'; '4h'; '5h'; '6h'; '7h'; '8h'; '9h'; '10h'; 'jh'; 'qh'; 'kh'; 'ah'; '2d'; '3d'; '4d'; '5d'; '6d'; '7d'; '8d'; '9d'; '10d'; 'jd'; 'qd'; 'kd'; 'ad'; '2s'; '3s'; '4s'; '5s'; '6s'; '7s'; '8s'; '9s'; '10s'; 'js'; 'qs'; 'ks'; 'as'; '2c'; '3c'; '4c'; '5c'; '6c'; '7c'; '8c'; '9c'; '10c'; 'jc'; 'qc'; 'kc'; 'ac'; 'J'; 'J'} h = (sum(sum(ismember(deckCheck,dealtDeck))) == 30) & ~issorted(reshape(dealtDeck,30,1)); g = (sum(ismember(deckCheck,deckLeftover)) == (54-30)) & ~issorted(deckLeftover); y_correct = g&h; assert(isequal(g,h))

dealtDeck = 5×6 cell array 'J' 'ad' '5d' '4c' '9c' '10s' 'J' '3h' 'qs' '8s' 'qh' '10c' 'jc' '3d' 'jh' 'as' '8h' '6h' '9d' 'kc' '3c' 'kd' '10d' '2s' '6s' 'ac' '7d' '5h' '2d' '2h' deckLeftover = 1×24 cell array Columns 1 through 12 '7h' 'ks' '8d' 'kh' '8c' '9h' '7c' '6c' 'qd' 'qc' '4h' '7s' Columns 13 through 24 '10h' 'jd' '2c' '4d' '4s' 'js' 'ah' '3s' '6d' '5c' '9s' '5s' deckCheck = 54×1 cell array '2h' '3h' '4h' '5h' '6h' '7h' '8h' '9h' '10h' 'jh' 'qh' 'kh' 'ah' '2d' '3d' '4d' '5d' '6d' '7d' '8d' '9d' '10d' 'jd' 'qd' 'kd' 'ad' '2s' '3s' '4s' '5s' '6s' '7s' '8s' '9s' '10s' 'js' 'qs' 'ks' 'as' '2c' '3c' '4c' '5c' '6c' '7c' '8c' '9c' '10c' 'jc' 'qc' 'kc' 'ac' 'J' 'J'

5   Pass
people = 3; cardsDelt = 4; isJokerIn = 1; [dealtDeck, deckLeftover] = Poker_Deal(people ,cardsDelt ,isJokerIn) deckCheck = {'2h'; '3h'; '4h'; '5h'; '6h'; '7h'; '8h'; '9h'; '10h'; 'jh'; 'qh'; 'kh'; 'ah'; '2d'; '3d'; '4d'; '5d'; '6d'; '7d'; '8d'; '9d'; '10d'; 'jd'; 'qd'; 'kd'; 'ad'; '2s'; '3s'; '4s'; '5s'; '6s'; '7s'; '8s'; '9s'; '10s'; 'js'; 'qs'; 'ks'; 'as'; '2c'; '3c'; '4c'; '5c'; '6c'; '7c'; '8c'; '9c'; '10c'; 'jc'; 'qc'; 'kc'; 'ac'; 'J'; 'J'} h = (sum(sum(ismember(deckCheck,dealtDeck))) == 12) & ~issorted(reshape(dealtDeck,12,1)); g = (sum(ismember(deckCheck,deckLeftover)) == (54-12)) & ~issorted(deckLeftover); y_correct = g&h; assert(isequal(g,h))

dealtDeck = 3×4 cell array 'J' '9d' '3h' 'ac' 'J' '6s' '3d' '5d' 'jc' 'ad' 'kc' 'qs' deckLeftover = 1×42 cell array Columns 1 through 12 'jh' '3c' '7d' '4c' '8s' 'as' 'kd' '5h' '9c' 'qh' '8h' '10d' Columns 13 through 24 '2d' '10s' '10c' '6h' '2s' '2h' '7h' 'ks' '8d' 'kh' '8c' '9h' Columns 25 through 36 '7c' '6c' 'qd' 'qc' '4h' '7s' '10h' 'jd' '2c' '4d' '4s' 'js' Columns 37 through 42 'ah' '3s' '6d' '5c' '9s' '5s' deckCheck = 54×1 cell array '2h' '3h' '4h' '5h' '6h' '7h' '8h' '9h' '10h' 'jh' 'qh' 'kh' 'ah' '2d' '3d' '4d' '5d' '6d' '7d' '8d' '9d' '10d' 'jd' 'qd' 'kd' 'ad' '2s' '3s' '4s' '5s' '6s' '7s' '8s' '9s' '10s' 'js' 'qs' 'ks' 'as' '2c' '3c' '4c' '5c' '6c' '7c' '8c' '9c' '10c' 'jc' 'qc' 'kc' 'ac' 'J' 'J'

6   Pass
people = 3; cardsDelt = 3; isJokerIn = 1; [dealtDeck, deckLeftover] = Poker_Deal(people ,cardsDelt ,isJokerIn) deckCheck = {'2h'; '3h'; '4h'; '5h'; '6h'; '7h'; '8h'; '9h'; '10h'; 'jh'; 'qh'; 'kh'; 'ah'; '2d'; '3d'; '4d'; '5d'; '6d'; '7d'; '8d'; '9d'; '10d'; 'jd'; 'qd'; 'kd'; 'ad'; '2s'; '3s'; '4s'; '5s'; '6s'; '7s'; '8s'; '9s'; '10s'; 'js'; 'qs'; 'ks'; 'as'; '2c'; '3c'; '4c'; '5c'; '6c'; '7c'; '8c'; '9c'; '10c'; 'jc'; 'qc'; 'kc'; 'ac'; 'J'; 'J'} h = (sum(sum(ismember(deckCheck,dealtDeck))) == 9) & ~issorted(reshape(dealtDeck,9,1)); g = (sum(ismember(deckCheck,deckLeftover)) == (54-9)) & ~issorted(deckLeftover); y_correct = g&h; assert(isequal(g,h))

dealtDeck = 3×3 cell array 'J' '9d' '3h' 'J' '6s' '3d' 'jc' 'ad' 'kc' deckLeftover = 1×45 cell array Columns 1 through 12 'ac' '5d' 'qs' 'jh' '3c' '7d' '4c' '8s' 'as' 'kd' '5h' '9c' Columns 13 through 24 'qh' '8h' '10d' '2d' '10s' '10c' '6h' '2s' '2h' '7h' 'ks' '8d' Columns 25 through 36 'kh' '8c' '9h' '7c' '6c' 'qd' 'qc' '4h' '7s' '10h' 'jd' '2c' Columns 37 through 45 '4d' '4s' 'js' 'ah' '3s' '6d' '5c' '9s' '5s' deckCheck = 54×1 cell array '2h' '3h' '4h' '5h' '6h' '7h' '8h' '9h' '10h' 'jh' 'qh' 'kh' 'ah' '2d' '3d' '4d' '5d' '6d' '7d' '8d' '9d' '10d' 'jd' 'qd' 'kd' 'ad' '2s' '3s' '4s' '5s' '6s' '7s' '8s' '9s' '10s' 'js' 'qs' 'ks' 'as' '2c' '3c' '4c' '5c' '6c' '7c' '8c' '9c' '10c' 'jc' 'qc' 'kc' 'ac' 'J' 'J'

Suggested Problems

More from this Author17