Cody

# Problem 376. Poker Series 05: isStraight

Solution 318306

Submitted on 12 Sep 2013 by Bart
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
%% hm = [0 1 0 0 0 0 0 0 1 1 0 1 1 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; y_correct.flag = false; y_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]) assert(isequal(isStraight(hm),y_correct))

y_correct = flag: 0 usedCards: [4x13 logical] Dff = 1 2 2 1 1 1 3 3 1 Dff6 = 0 0 0 0 0 0 0 0 0 out = usedCards: [4x13 double] flag: 0

2   Pass
%% hm = [0 1 1 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 0 1 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0]; y_correct.flag = true; y_correct.usedCards = logical([0 1 1 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 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0]) assert(isequal(isStraight(hm),y_correct))

y_correct = flag: 1 usedCards: [4x13 logical] Dff = 1 6 1 1 2 2 1 1 Dff6 = 0 1 0 0 0 0 0 0 out = usedCards: [4x13 double] flag: 1 Ir = 3 4 5 6 7

3   Pass
%% hm = [0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0]; y_correct.flag = true; y_correct.usedCards = logical([0 1 1 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 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0]) assert(isequal(isStraight(hm),y_correct))

y_correct = flag: 1 usedCards: [4x13 logical] Dff = 1 6 1 1 2 2 1 1 Dff6 = 0 1 0 0 0 0 0 0 out = usedCards: [4x13 double] flag: 1 Ir = 3 4 5 6 7

4   Pass
%% hm = [0 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0]; y_correct.flag = true; y_correct.usedCards = logical([0 1 1 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 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0]) assert(isequal(isStraight(hm),y_correct))

y_correct = flag: 1 usedCards: [4x13 logical] Dff = 7 1 1 2 2 2 Dff6 = 1 0 0 0 0 0 out = usedCards: [4x13 double] flag: 1 Ir = 3 4 5 6 7

5   Pass
%% hm = [0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 1 0 1 0 1 0 0 0 1 0 0 0 0 0 0 0 1]; y_correct.flag = true; y_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0]) assert(isequal(isStraight(hm),y_correct))

y_correct = flag: 1 usedCards: [4x13 logical] Dff = 7 1 1 6 Dff6 = 1 0 0 1 out = usedCards: [4x13 double] flag: 1 Ir = 11 12 13 14 15

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!