Cody

Problem 333. Poker Series 02: isQuads

Solution 53424

Submitted on 28 Feb 2012 by Aurelien Queffurust
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

Test Suite

Test Status Code Input and Output
1   Pass
clear clc

2   Pass
%% hm = [0 0 0 0 0 0 0 0 1 1 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 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(isQuads(hm),y_correct))

y_correct = flag: 0 usedCards: [4x13 logical] index_col_to_inspect = Empty matrix: 1-by-0

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

y_correct = flag: 1 usedCards: [4x13 logical] index_col_to_inspect = 9 r = 1 2 3 4 1 col = 9 9 9 9 13 kicker_column = 13 infa = 5 a = 13 b = 1 out = usedCards: [4x13 logical] flag: 1

4   Pass
%%

5   Pass
%% hm = [0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 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(isQuads(hm),y_correct))

y_correct = flag: 0 usedCards: [4x13 logical] index_col_to_inspect = 9

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

y_correct = flag: 1 usedCards: [4x13 logical] index_col_to_inspect = 9 r = 1 1 2 3 4 1 col = 1 9 9 9 9 13 kicker_column = 1 13 infa = 1 6 a = 1 b = 1 out = usedCards: [4x13 logical] flag: 1

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

y_correct = flag: 1 usedCards: [4x13 logical] index_col_to_inspect = 9 r = 2 4 1 2 3 4 col = 2 2 9 9 9 9 kicker_column = 2 infa = 2 a = 2 b = 1 out = usedCards: [4x13 logical] flag: 1

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

y_correct = flag: 1 usedCards: [4x13 logical] index_col_to_inspect = 9 r = 1 1 2 3 4 1 2 3 4 1 col = 1 4 4 4 4 9 9 9 9 13 kicker_column = 1 13 infa = 1 10 a = 1 b = 1 out = usedCards: [4x13 logical] flag: 1

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

index_col_to_inspect = 1 r = 1 2 3 4 1 2 3 4 2 col = 1 1 1 1 8 8 8 8 13 kicker_column = 13 infa = 9 a = 13 b = 1 out = usedCards: [4x13 logical] flag: 1