Cody

Problem 333. Poker Series 02: isQuads

Solution 2182417

Submitted on 30 Mar 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
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 = struct with fields: flag: 0 usedCards: [4×13 logical]

Unable to perform assignment because the size of the left side is 4-by-0 and the size of the right side is 4-by-1. Error in isQuads (line 4) mh(:,qs) = [0; 0; 0; 0]; Error in Test1 (line 11) assert(isequal(isQuads(hm),y_correct))

2   Fail
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 = struct with fields: flag: 1 usedCards: [4×13 logical] qm = 9 lx = 1 out = struct with fields: usedCards: [4×13 logical] out = struct with fields: usedCards: [4×13 logical] flag: 1

Assertion failed.

3   Fail
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 = struct with fields: flag: 0 usedCards: [4×13 logical] qm = 9 lx = 0×1 empty double column vector out = struct with fields: usedCards: [4×13 logical]

Operands to the || and && operators must be convertible to logical scalar values. Error in isQuads (line 12) out.flag = qm && lx Error in Test3 (line 11) assert(isequal(isQuads(hm),y_correct))

4   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 = struct with fields: flag: 1 usedCards: [4×13 logical] qm = 9 lx = 1 out = struct with fields: usedCards: [4×13 logical] out = struct with fields: usedCards: [4×13 logical] flag: 1

5   Fail
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 = struct with fields: flag: 1 usedCards: [4×13 logical] qm = 9 lx = 13 out = struct with fields: usedCards: [13×13 logical] out = struct with fields: usedCards: [13×13 logical] flag: 1

Assertion failed.

6   Fail
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 = struct with fields: flag: 1 usedCards: [4×13 logical]

Unable to perform assignment because the size of the left side is 4-by-2 and the size of the right side is 4-by-1. Error in isQuads (line 4) mh(:,qs) = [0; 0; 0; 0]; Error in Test6 (line 11) assert(isequal(isQuads(hm),y_correct))

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

Unable to perform assignment because the size of the left side is 4-by-2 and the size of the right side is 4-by-1. Error in isQuads (line 4) mh(:,qs) = [0; 0; 0; 0]; Error in Test7 (line 13) assert(isequal(isQuads(hm),y_correct))