Use Hand.winners(hands) to determine which hands among a group are the winners. This method handles:
- Qualification: It filters out hands that do not meet the game's qualification requirements (if
qualifiesHigh() is false). - Highest Rank: It identifies the highest rank present among the remaining hands.
- Tie-breaking: It filters the highest-ranked hands to find those that do not lose to any other hand in the set (handling ties).
Parameters:
hands (Array<Hand>): An array of Hand instances to compare.
Returns:
- An array of
Hand instances that are the winners.
const hand1 = Hand.solve(['Ad', 'Kd', 'Qd', 'Jd', '2d'], 'standard');
const hand2 = Hand.solve(['As', 'Ks', 'Qs', 'Js', '2s'], 'standard');
const hand3 = Hand.solve(['2c', '3c', '4c', '5c', '6c'], 'standard');
const winners = Hand.winners([hand1, hand2, hand3]);
// winners will contain both hand1 and hand2 if they tied for the highest rank