# Cody challenges added: Poker Series

Cody is a great way to learn MATLAB. Recently, a new series of problems have been added. This series of problems will be excellent for people that are new to MATLAB to solve. There are 11 problems, that taken together will walk you down a path such that at the end, you will have some code that can compare two sets of playing cards and determine which can make the better poker hand.

The math behind this will give you a chance to practice lots of indexing, comparisons, pattern matching, flow control, cell arrays, structures, sub-functions, etc. The test suites have been designed to catch as many edge cases as possible so that to successfully finish each function, you will need to really get it right. You then will get a chance to reuse the code from each challenge to the next.

You will also be able to see how other people solve these problems. For instance, I have put my solution in there to be viewed. My code is usually very long, but easy to understand. You will also see other people using more advanced techniques that use less lines of code. This gives you a chance to see code of known functionality that uses (possibly) unfamiliar techniques.

I recommend you start with the code IsStraightFlush.

Can you make code that can tell that this matrix:

[0 0 0 0 0 0 0 0 0 0 0 0 0;
0 0 1 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 0 0 0 0 0 0];
contains five cards in the same row and adjacent columns, while [0 0 0 0 0 0 0 0 0 0 0 0 0; 0 0 1 1 1 0 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 0 0 0 0 1 0]; does not? What about the tricky case where the Ace (column 1) is considered high? [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; 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];
|

### Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.