Skip to main content

Timeline for How to sort poker hands? c++

Current License: CC BY-SA 3.0

7 events
when toggle format what by license comment
Apr 18, 2018 at 16:38 comment added ChrisPy @RangerBob Basically, make a class that has the cards, and a enum in it that contains the type of hand, and make a custom sort based on the state of that enum.
Mar 20, 2018 at 9:33 comment added RangerBob I understand but my question is how can I do that?
Mar 19, 2018 at 21:28 comment added congusbongus @RangerBob some classes need to be sorted differently. Most of the time you can sort them as-is, but for hands like the full house, you need to make sure the 3-of-a-kind is ahead of the pair. Finally sort the rest of the cards normally. You don't need to worry about the kicker, it's just a fancy way of saying "the highest of the leftover cards".
Mar 19, 2018 at 21:23 history edited congusbongus CC BY-SA 3.0
grammar
Mar 19, 2018 at 10:45 comment added ratchet freak @RangerBob you first decide that it is a single pair so that pair should be at the start, then the rest of the cards are sorted high to low. When comparing hands of the different classes you first compare the class and then you compare the hands themselves, that way a 4-of-a-kind with 2s beats a Ace high
Mar 19, 2018 at 8:50 comment added RangerBob Thank you for your reply but that was not exactly my question. It seems that you just repeated what they said in the example I gave above. I already determined the class of my hands. What I want to do is an algorithm to rank in the way I mentioned the cards for a specific hand: I a hand is 39772, how to sort it such as I got : 77932?
Mar 18, 2018 at 23:29 history answered congusbongus CC BY-SA 3.0