define "higher up", is row 1 higher or lower than row 4?
Don't test with with 2 or more straight flushes with different rankings.
@Jean,
Huh? Is that a suggestion to add a test?
Yes, as for example test 8 in problem 333 : Poker Series 02: isQuads.
It is better to modify the last test case as hm = [0 0 0 0 0 0 0 0 1 1 0 1 1;
1 1 0 0 0 0 0 0 0 1 1 1 1;
1 0 0 0 0 0 0 0 0 1 1 1 1;
0 0 0 0 0 0 0 0 0 0 0 0 0];
y_correct.flag = true;
y_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 0 0 0 0;
1 0 0 0 0 0 0 0 0 1 1 1 1;
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]), where I have interchanged the 2nd and 3rd rows of hm. The reason to make this change is that some solutions which simply check whether the row sum equals 5 are indeed incorrect.
Very late here since the last comment, but if you care to update, my code passed all the tests but it ran into an error when dealing with a normal flush. May want to put a test in there for five 1's in a single row but not consecutive
So, just to clarify, because in normal poker, 9 10 J Q K beats A 2 3 4 5, at least I think and an online simulator proved that to be correct...
in your case, A high beats K high? I might need to analyze the expected answers a bit but you did say in your problem statement that A high trumps, so I just wanted to check
Is there a problem with the third test? Looks like a fourth test was being created. I think my solution should pass.
The second part of Test 3 looks incorrect. This problem has two straight flushes on rows 2 & 3. However, the expected solution only shows a straight flush on row 2
hm = [0 0 0 0 0 0 0 0 1 1 0 1 1
1 0 0 0 0 0 0 0 0 1 1 1 1
1 1 0 0 0 0 0 0 0 1 1 1 1
0 0 0 0 0 0 0 0 0 0 0 0 0];
y_correct.flag = true;
y_correct.usedCards = logical([0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 1 1 1 1
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(isStraightFlush(hm),y_correct))
This should satisfy the second part.. I think.
This should only satisfy the first part.
">
263 Solvers
Get the length of a given vector
4397 Solvers
Return a list sorted by number of consecutive occurrences
214 Solvers
Create a Multiplication table matrix...
308 Solvers
Is this triangle right-angled?
2903 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!