Right now I’m writing a program that will determine the value of a hand of cards. five in total. i have a cardHand object. I’m planning to write an object that compares two objects together in order to determine which hand has a higher value. the two objects that will be compared are objects that contain the possible hand values (one pair, three of a kind… etc).
would stackoverflow see this as a fit method of OOP?
PS: i do know that the algorithm is floating around on the internet but im trying to do this by my self first for the XP.
What you’ll want to do is something like this:
operator<to this class so you can determine the sorting of individual cards.If you store your cards in an
std::multisetin the hand, your cards will group themselves together automatically.That is, if you insert
2, 7, 3, 4, 3they will be in this order:2, 3, 3, 4, 7. This will help you determine things like pairs and tuplets.