I did this four years ago and I really cant remember much about it. I had a look at the code but couldn't understand it in the time I have available There are several versions so I don't know which is correct so will not post it since I don't want to have to defend something which turns out to be wrong. But maybe this will be helpful
/* Generates legal suit patterns for all legal rank patterns. * * Legal rank patterns are 222, 223, 233, 234 but not 232, 235 or 333. For speed only prototypes are generated. * Legal suit patterns are ccc, ccd, cdc, cdd, cdh but not cch, dcc. * Not all legal suit patterns can be combined with all legal rank patterns. Clearly 222 and ccc are impossible. * Some rank suit combinations are duplicates. eg 2234 cdcd and cddc * * The duplicates are removed finding ranks by suit. eg 2c2d3c4d becomes c23 d24, and 2c2d3d4c becomes c24 d23. * */
Strikes me the state machine that underlies the evaluator I posted does the job too.
Sorry I can't help more
|