When I solved the problem I found the code to be modular and simple. I thought it can help others in learning logical thinking and how to simplify a big problem into several smaller ones. This is why I don't think I'm breaking any ethical barriers by submitting the solution here.
I see some changes have been made. These extra comments really help the person reading the code. My thanks there.
Personally, I'd still hope that beginning PE solvers try the problem first, before looking at this. Only afterwards should you read through this submission to compare this code to yours. But this is a reasonable approach to the problem.
I'll still abstain on an actual rating, but if I were to give this a numeric rating, my rating would be a decent one.
Ok. I'll admit that part of me wishes that Husam did not post this submission, but only a small part of me thinks that way. Why? Because I am a great admirer of the Project Euler problems. They afford a great sense of satisfaction in the solving, knowing that you have used your skills in MATLAB to solve these problems. Most problems require some insight, some understanding of a mathematical concept, as well as not insignificant programming skill to solve in your chosen language. As such they are a tremendous vehicle to help you to learn to use a tool like MATLAB. I have always maintained that the best way to learn a language is to have a project that requires solving.
So I hope that most Euler solvers will choose to solve the problems on their own, first, only then look to the occasional published solutions they will find on the net.
On the other hand, this is one of the moderately easy PE problems. if this particular solution causes others to find an interest of their own in these same problems, then it is worth having posted it. As I said, my opinion is mixed here. While I am quite happy to see some advertising for others to begin the Project Euler adventure, I hope not to see solutions to each problem appear here on the FEX.
As for the code itself, I won't offer a rating because of those mixed feelings. I do very much like that the code is written in a modular fashion.
There are useful comments in the main block of code - a good start there, although the comments get sparser towards the end. The individual modules are entirely without comments though, and this is a place where those comments would have been most valuable. How for example, did the author choose to test if a hand is a flush? 3 of a kind? A tutorial code should explain itself.
Is there anything else that I might have hoped to see? Yes. Very often solving a problem like this requires the programmer to implement an encoding for the data. In this case, is there an efficient way to encode the hands for evaluation of the potential of those hands? I'd have liked to see some exposition on the data structure employed, as I can think of at least two or three ways to store them. Careful advance thought about the data structures employed is often critical to an efficient solution of the problem down the line.
Again, my point is to use this tool as a means to teach how to use matlab to solve a problem. Help the person reading your code to understand how you solved the problem.
Updates
02 Jul 2009
Commented files, did minor corrections, added joke.