poker-evaluator icon indicating copy to clipboard operation
poker-evaluator copied to clipboard

Royal flush is recognized as straight flush

Open y0unghe opened this issue 1 year ago • 1 comments

I am trying to get a royal flush using below code, but it returned as straight flush. From 10 to A, it's all Spade. It should be royal flush, right?

const evaluator = require('../lib/PokerEvaluator');

const royalFlush = evaluator.evalHand(["As", "Ks", "Qs", "Js", "Ts", "3c", "7h"]);
console.log(royalFlush);

y0unghe avatar Sep 26 '23 14:09 y0unghe

Hi @y0unghe

You’re right, although in this library there is no technical difference between a straight flush and a royal flush, apart from the latter being higher/beating the former.

See hand types here https://github.com/chenosaurus/poker-evaluator/blob/master/lib/PokerEvaluator.js#L16

Technically a royal flush is just the nut straight flush, so I think this is correct, although it would perhaps be an improvement to distinguish between the two.

In any case the library does correctly evaluate your hand beating a (lower) straight flush. If you were to submit a pull request updating the hand rankings I’m sure it would be considered

rorymcgit avatar Sep 26 '23 15:09 rorymcgit