PLEASE HELP ME: This rummy game is driving me nuts!!!!
Posted on 2003-03-03
In my project, I am suppose to create an agent that plays a simple version of rummy. To win this game, the agent is dealt seven cards initially, and in order to win, it has to create two sets of combination of cards (one of 3 cards the other of 4), each combination can either have cards of the same rank (eg. 10 Hearts, 10 Clubs, 10 Spades) or the same sequence, but the same suit (2s,3s,4s,5s OR 7c,8c,9c).
Beside the main SDK, we have our own api for this game, that for example lets you check whether two cards are in the same rank (eg. (10H.sameRank(10D) returns true), or whether they have the same suit or not.
I have no trouble creating a hand of cards with the same rank, but my problem is with creating a hand of cards with the same sequence.
I have tried to come up with an algorithm that would allow me to create a hand of cards (of same suit) in the sequence, but without success. This thing is driving me nuts.
CAN ANYONE GIVE ME ANY GUIDANCE PLEASE!!