Cody

# Problem 1687. Poker Card Deal!

Solution 2087634

Submitted on 10 Jan 2020
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   Fail
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))

Conversion to cell from char is not possible. Error in Poker_Deal (line 19) deckNamedOrder(i)= strcat( ranks{mod(i,13)},suits{mod(i,4)}) ; Error in Test1 (line 4) [dealtDeck, deckLeftover] = Poker_Deal(people ,cardsDelt ,isJokerIn)

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

Conversion to cell from char is not possible. Error in Poker_Deal (line 19) deckNamedOrder(i)= strcat( ranks{mod(i,13)},suits{mod(i,4)}) ; Error in Test2 (line 4) [dealtDeck, deckLeftover] = Poker_Deal(people ,cardsDelt ,isJokerIn)

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

Conversion to cell from char is not possible. Error in Poker_Deal (line 19) deckNamedOrder(i)= strcat( ranks{mod(i,13)},suits{mod(i,4)}) ; Error in Test3 (line 4) [dealtDeck, deckLeftover] = Poker_Deal(people ,cardsDelt ,isJokerIn)

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

Conversion to cell from char is not possible. Error in Poker_Deal (line 19) deckNamedOrder(i)= strcat( ranks{mod(i,13)},suits{mod(i,4)}) ; Error in Test4 (line 4) [dealtDeck, deckLeftover] = Poker_Deal(people ,cardsDelt ,isJokerIn)

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

Conversion to cell from char is not possible. Error in Poker_Deal (line 19) deckNamedOrder(i)= strcat( ranks{mod(i,13)},suits{mod(i,4)}) ; Error in Test5 (line 4) [dealtDeck, deckLeftover] = Poker_Deal(people ,cardsDelt ,isJokerIn)

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

Conversion to cell from char is not possible. Error in Poker_Deal (line 19) deckNamedOrder(i)= strcat( ranks{mod(i,13)},suits{mod(i,4)}) ; Error in Test6 (line 4) [dealtDeck, deckLeftover] = Poker_Deal(people ,cardsDelt ,isJokerIn)