goldfire / pokersolver Goto Github PK
View Code? Open in Web Editor NEWJavascript poker hand solver.
License: MIT License
Javascript poker hand solver.
License: MIT License
goto: https://www.npmjs.com/package/pokersolver#server-usage
It says var Hand = require('pokersolve').Hand;
should be: var Hand = require('pokersolver').Hand;
Shouldn't this line of code reference 2h
and not Ah
https://github.com/goldfire/pokersolver/blob/master/test/deuceswild.js#L23
The following will give me "Four of a Kind, A's" as expected:
Hand.solve(['Ad', 'As', 'Jc', 'Th', '2d', '0r', '0r']).descr;
However, the following is giving me "Full House, 10's over A's" instead of the expected "Four of a Kind, A's":
Hand.solve(['Ad', 'As', 'Ac', 'Th', '2d', '0r', '0r']).descr
I'd like to add the Omaha Hold'em rules to this library (I've been using the standard and works hells good).
Looking at how rules are set up, I was thinking on running all combinations of 2 from the hand cards and 3 from the table, but that might not be that performant.
Do you think there's a better approach for this @goldfire ?
Thanks in advance
var hand1 = Hand.solve(['Ad', '2s', '9h', '4d', '5h']);
hand1.name = 'preetham';
console.log('hand1 ==>'+hand1.name); // Two Pair
console.log('hand1 ==> '+hand1.descr);
var hand2 = Hand.solve(['Ad', 'As', 'Jc', '3h', '2d']);
hand2.name='rocker';
console.log('hand2 ==> '+hand2.name); // Two Pair
console.log('hand2 ==>'+hand2.descr);
var hand3 = Hand.solve(['Ah', 'Ac', 'Jd', '3c', '2f']);
hand3.name='Baxish';
console.log('hand2 ==> '+hand3.name); // Two Pair
console.log('hand2 ==>'+hand3.descr);
var winner = Hand.winners([hand1, hand3,hand2]);
console.log(winner[0].name)
Hi Team
I got an issue with Royal Flush Hand Strength with these cards.
var communityCardss = ["3s","Jh","Qh","Th","8c"];
Var Playercards = [
"Kh",
"Kd",
"5h",
"5d",
"Ah"
];
OutPut:
name: 'Straight Flush',
descr: 'Royal Flush',
cardCombination: [ 'Ah', 'Kh', 'Qh', 'Jh', 'Th' ],
rankname: 'Straight Flush',
rankdesc: 'Royal Flush' } ]
But it should be
Name: 'Royal Flush'
I'm running on Ubuntu.
I'm installing pokersolver like so, while in the directory of my project:
npm install pokersolver
I'm trying to run a file where this is the only line:
var Hand = require('pokersolve').Hand;
This causes a "Can't find module 'pokersolve'" error. I figure it's a type so I've changed it to:
var Hand = require('pokersolver').Hand;
Which causes the following error
/media/E/Storage/Code/project/node_modules/pokersolver/pokersolver.js:16
class Card {
^^^^^
SyntaxError: Unexpected reserved word
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/media/E/Storage/Code/flopzilla/new_zilla.js:1:74)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
Board: 10s Jd Qc 6d 5c
Hand1: 9h Ks
Hand2: 9s Ah
Expected result: Hand1 wins, Straight
Actual result: Hand2 wins. A high
Sorry if I missed this but just wonder if there’s a global sub ranking for each possible hand?
Hi, I'm poking around with the library and making a few tests before using it. If I solve a handle with two duplicate cards (Queen of diamond for example) the returning structure still has a isPossible
flag to true. Shouldn't it be false?
First of all, thank you for making this useful module.
I'm working with this product and found some interesting point:
9c Kh Kd 9s Ah
Qc 5h
5d Jd
Library returns two winners, but as we can assume, due to kicker, winner is 1st player. Is it possible to distinguish somehow community cards or hand cards to make correct output for Hand.winners
method?
Thanks in advance!
if the board is flush with heart and some players have heart then all players are winners !!! WRONGG
for more information : flush board rules
What would using the solver Double Deuces Wild for imply?
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?
For the statement, console.log("output", Hand.solve([ 'Ts', 'Qh', '7c', '8s', '9s']))
, it is returning me
High Card
, and expected result is Straight
.
console.log(Hand.solve(['2s','Kc','Jc','2d','Qc'],'deuceswild').name)
evaluates to only a straight flush. Same goes for a natural royal.
If you change .name to .descr it works, but adds extra info for all the other hands. I am trying to figure out a fix, but these evaluation libraries are always convoluted to the person that didn't write them.
Joker Wild does not payout a pair of Kings yet is says in the documentation that it does.
Two Pair is currently ranked 2,
When using Hand.solve([ 'Ad', '3s', '5c', '5h', '0r' ])
I was not expecting the Joker to have any impact on the hand, but instead the hand is evaluated as Three of a Kind, 5's
.
Hand.solve() seems to be working fine, but when trying to compare hands with Hand.winners(), I get the following error: 'h.qualifiesHigh is not a function'
console.log(hand1, hand2)
// ['9h', '4s', '5s', 'Ts', '7d', 'Jh', 'Jc'] (7) ['9h', '4s', '5s', 'Ts', '7d', 'As', 'Ks']
console.log(Hand.solve(hand1), Hand.solve(hand2))
// OnePair {cardPool: Array(7), cards: Array(5), suits: {…}, values: Array(11), wilds: Array(0), …}
// Flush {cardPool: Array(7), cards: Array(5), suits: {…}, values: Array(14), wilds: Array(0), …}
console.log(Hand.winners([hand1, hand2]))
// TypeError: h.qualifiesHigh is not a function
error seems to stem from the following lines of code
hands = hands.filter(function(h) {
return h.qualifiesHigh();
});
Hey.
I want to evaluate low hands(worst hand) (7 cards), standard deck, game type = standard. Is that possible using this library ? How to achieve that ?
Thanks.
When applying the module for my poker server I found interesting that the method winners doesn't return the position of the winner in the array of hands passed. I think it would be really useful. Do I start working on that or is there some solution to this problem that I'm not seeing?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.