Cody

Solution 1219342

Submitted on 24 Jun 2017 by LY Cao
  • Size: 37
  • 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
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))

ans = 52×1 cell array '10c' '10d' '10h' '10s' '2c' '2d' '2h' '2s' '3c' '3d' '3h' '3s' '4c' '4d' '4h' '4s' '5c' '5d' '5h' '5s' '6c' '6d' '6h' '6s' '7c' '7d' '7h' '7s' '8c' '8d' '8h' '8s' '9c' '9d' '9h' '9s' 'ac' 'ad' 'ah' 'as' 'jc' 'jd' 'jh' 'js' 'kc' 'kd' 'kh' 'ks' 'qc' 'qd' 'qh' 'qs' dealtDeck = 5×5 cell array '10c' '2d' '3h' '4s' '6c' '10d' '2h' '3s' '5c' '6d' '10h' '2s' '4c' '5d' '6h' '10s' '3c' '4d' '5h' '6s' '2c' '3d' '4h' '5s' '7c' deckLeftover = 27×1 cell array '7d' '7h' '7s' '8c' '8d' '8h' '8s' '9c' '9d' '9h' '9s' 'ac' 'ad' 'ah' 'as' 'jc' 'jd' 'jh' 'js' 'kc' 'kd' 'kh' 'ks' 'qc' 'qd' 'qh' 'qs' 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))

ans = 52×1 cell array '10c' '10d' '10h' '10s' '2c' '2d' '2h' '2s' '3c' '3d' '3h' '3s' '4c' '4d' '4h' '4s' '5c' '5d' '5h' '5s' '6c' '6d' '6h' '6s' '7c' '7d' '7h' '7s' '8c' '8d' '8h' '8s' '9c' '9d' '9h' '9s' 'ac' 'ad' 'ah' 'as' 'jc' 'jd' 'jh' 'js' 'kc' 'kd' 'kh' 'ks' 'qc' 'qd' 'qh' 'qs' dealtDeck = 5×3 cell array '10c' '2d' '3h' '10d' '2h' '3s' '10h' '2s' '4c' '10s' '3c' '4d' '2c' '3d' '4h' deckLeftover = 37×1 cell array '4s' '5c' '5d' '5h' '5s' '6c' '6d' '6h' '6s' '7c' '7d' '7h' '7s' '8c' '8d' '8h' '8s' '9c' '9d' '9h' '9s' 'ac' 'ad' 'ah' 'as' 'jc' 'jd' 'jh' 'js' 'kc' 'kd' 'kh' 'ks' 'qc' 'qd' 'qh' 'qs' 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))

ans = 52×1 cell array '10c' '10d' '10h' '10s' '2c' '2d' '2h' '2s' '3c' '3d' '3h' '3s' '4c' '4d' '4h' '4s' '5c' '5d' '5h' '5s' '6c' '6d' '6h' '6s' '7c' '7d' '7h' '7s' '8c' '8d' '8h' '8s' '9c' '9d' '9h' '9s' 'ac' 'ad' 'ah' 'as' 'jc' 'jd' 'jh' 'js' 'kc' 'kd' 'kh' 'ks' 'qc' 'qd' 'qh' 'qs' dealtDeck = 7×4 cell array '10c' '2s' '4h' '6d' '10d' '3c' '4s' '6h' '10h' '3d' '5c' '6s' '10s' '3h' '5d' '7c' '2c' '3s' '5h' '7d' '2d' '4c' '5s' '7h' '2h' '4d' '6c' '7s' deckLeftover = 24×1 cell array '8c' '8d' '8h' '8s' '9c' '9d' '9h' '9s' 'ac' 'ad' 'ah' 'as' 'jc' 'jd' 'jh' 'js' 'kc' 'kd' 'kh' 'ks' 'qc' 'qd' 'qh' 'qs' 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))

ans = 52×1 cell array '10c' '10d' '10h' '10s' '2c' '2d' '2h' '2s' '3c' '3d' '3h' '3s' '4c' '4d' '4h' '4s' '5c' '5d' '5h' '5s' '6c' '6d' '6h' '6s' '7c' '7d' '7h' '7s' '8c' '8d' '8h' '8s' '9c' '9d' '9h' '9s' 'ac' 'ad' 'ah' 'as' 'jc' 'jd' 'jh' 'js' 'kc' 'kd' 'kh' 'ks' 'qc' 'qd' 'qh' 'qs' ans = 54×1 cell array '10c' '10d' '10h' '10s' '2c' '2d' '2h' '2s' '3c' '3d' '3h' '3s' '4c' '4d' '4h' '4s' '5c' '5d' '5h' '5s' '6c' '6d' '6h' '6s' '7c' '7d' '7h' '7s' '8c' '8d' '8h' '8s' '9c' '9d' '9h' '9s' 'J' 'J' 'ac' 'ad' 'ah' 'as' 'jc' 'jd' 'jh' 'js' 'kc' 'kd' 'kh' 'ks' 'qc' 'qd' 'qh' 'qs' dealtDeck = 6×5 cell array '10c' '2h' '4c' '5h' '7c' '10d' '2s' '4d' '5s' '7d' '10h' '3c' '4h' '6c' '7h' '10s' '3d' '4s' '6d' '7s' '2c' '3h' '5c' '6h' '8c' '2d' '3s' '5d' '6s' '8d' deckLeftover = 23×1 cell array '8h' '8s' '9c' '9d' '9h' '9s' 'J' 'ac' 'ad' 'ah' 'as' 'jc' 'jd' 'jh' 'js' 'kc' 'kd' 'kh' 'ks' 'qc' 'qd' 'qh' 'qs' 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))

ans = 52×1 cell array '10c' '10d' '10h' '10s' '2c' '2d' '2h' '2s' '3c' '3d' '3h' '3s' '4c' '4d' '4h' '4s' '5c' '5d' '5h' '5s' '6c' '6d' '6h' '6s' '7c' '7d' '7h' '7s' '8c' '8d' '8h' '8s' '9c' '9d' '9h' '9s' 'ac' 'ad' 'ah' 'as' 'jc' 'jd' 'jh' 'js' 'kc' 'kd' 'kh' 'ks' 'qc' 'qd' 'qh' 'qs' ans = 54×1 cell array '10c' '10d' '10h' '10s' '2c' '2d' '2h' '2s' '3c' '3d' '3h' '3s' '4c' '4d' '4h' '4s' '5c' '5d' '5h' '5s' '6c' '6d' '6h' '6s' '7c' '7d' '7h' '7s' '8c' '8d' '8h' '8s' '9c' '9d' '9h' '9s' 'J' 'J' 'ac' 'ad' 'ah' 'as' 'jc' 'jd' 'jh' 'js' 'kc' 'kd' 'kh' 'ks' 'qc' 'qd' 'qh' 'qs' dealtDeck = 4×3 cell array '10c' '2c' '3c' '10d' '2d' '3d' '10h' '2h' '3h' '10s' '2s' '3s' deckLeftover = 41×1 cell array '4c' '4d' '4h' '4s' '5c' '5d' '5h' '5s' '6c' '6d' '6h' '6s' '7c' '7d' '7h' '7s' '8c' '8d' '8h' '8s' '9c' '9d' '9h' '9s' 'J' 'ac' 'ad' 'ah' 'as' 'jc' 'jd' 'jh' 'js' 'kc' 'kd' 'kh' 'ks' 'qc' 'qd' 'qh' 'qs' 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))

ans = 52×1 cell array '10c' '10d' '10h' '10s' '2c' '2d' '2h' '2s' '3c' '3d' '3h' '3s' '4c' '4d' '4h' '4s' '5c' '5d' '5h' '5s' '6c' '6d' '6h' '6s' '7c' '7d' '7h' '7s' '8c' '8d' '8h' '8s' '9c' '9d' '9h' '9s' 'ac' 'ad' 'ah' 'as' 'jc' 'jd' 'jh' 'js' 'kc' 'kd' 'kh' 'ks' 'qc' 'qd' 'qh' 'qs' ans = 54×1 cell array '10c' '10d' '10h' '10s' '2c' '2d' '2h' '2s' '3c' '3d' '3h' '3s' '4c' '4d' '4h' '4s' '5c' '5d' '5h' '5s' '6c' '6d' '6h' '6s' '7c' '7d' '7h' '7s' '8c' '8d' '8h' '8s' '9c' '9d' '9h' '9s' 'J' 'J' 'ac' 'ad' 'ah' 'as' 'jc' 'jd' 'jh' 'js' 'kc' 'kd' 'kh' 'ks' 'qc' 'qd' 'qh' 'qs' dealtDeck = 3×3 cell array '10c' '10s' '2h' '10d' '2c' '2s' '10h' '2d' '3c' deckLeftover = 44×1 cell array '3d' '3h' '3s' '4c' '4d' '4h' '4s' '5c' '5d' '5h' '5s' '6c' '6d' '6h' '6s' '7c' '7d' '7h' '7s' '8c' '8d' '8h' '8s' '9c' '9d' '9h' '9s' 'J' 'ac' 'ad' 'ah' 'as' 'jc' 'jd' 'jh' 'js' 'kc' 'kd' 'kh' 'ks' 'qc' 'qd' 'qh' 'qs' 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