Closed ghost closed 6 years ago
You know which won with the winners
method: https://github.com/goldfire/pokersolver#winnershands
var hand1 = Hand.solve(['6d', 'Jc', 'Tc', '2c', 'Ac', 'Ah', '3h']);
var hand2 = Hand.solve(['6d', 'Jc', 'Tc', '2c', 'Ac', 'Ad', '4d']);
var winner = Hand.winners([hand1,hand2]);
console.log(winner.length);
Who won? Hand 1? Hand 2? What about two Full Houses? If the winners array includes just one hand, how do you know which hand is in there?
In the example you gave there is no winner because they both have the same hand. But, if there was a single winner, the winners array passes back the hand(s) that won, so you can compare by reference: hand1 === winner[0]
.
Thank you.
How do you output which hand is a winner? If I get two hands that are both A-high, the description doesn't include the kicker. How do I know which won?