### Install pokersolver with npm
Source: https://github.com/goldfire/pokersolver/blob/master/README.md
Use npm to install the pokersolver library for your project.
```bash
npm install pokersolver
```
--------------------------------
### Install and Test Project
Source: https://github.com/goldfire/pokersolver/blob/master/README.md
Instructions for installing project dependencies and running tests using npm.
```bash
npm install
npm test
```
--------------------------------
### Instantiate and Check Poker Hand Types
Source: https://context7.com/goldfire/pokersolver/llms.txt
Demonstrates how to import and use individual hand type classes to check if a given set of cards is possible and to get a description of the hand. Requires importing the Game class and specific hand type classes.
```javascript
var pokersolver = require('pokersolver');
var Game = pokersolver.Game;
var StraightFlush = pokersolver.StraightFlush;
var FourOfAKind = pokersolver.FourOfAKind;
var FullHouse = pokersolver.FullHouse;
var Flush = pokersolver.Flush;
var Straight = pokersolver.Straight;
var ThreeOfAKind = pokersolver.ThreeOfAKind;
var TwoPair = pokersolver.TwoPair;
var OnePair = pokersolver.OnePair;
var HighCard = pokersolver.HighCard;
var g = new Game('standard');
var sf = new StraightFlush(['Qd', '7s', '8s', 'Js', 'Kh', 'Ts', '9s'], g);
console.log(sf.isPossible, sf.descr); // true "Straight Flush, Js High"
var fok = new FourOfAKind(['7h', '7d', '3s', '2c', '7s', '7c', '4s'], g);
console.log(fok.isPossible, fok.descr); // true "Four of a Kind, 7's"
var fh = new FullHouse(['9c', 'Qs', '9h', '5h', 'Ts', 'Qc', 'Qh'], g);
console.log(fh.isPossible, fh.descr); // true "Full House, Q's over 9's"
console.log(fh.toString()); // "Qs, Qc, Qh, 9c, 9h"
var fl = new Flush(['4h', 'Th', '5h', 'Ac', '2h', 'Kh', '8d'], g);
console.log(fl.isPossible, fl.descr); // true "Flush, Kh High"
var st = new Straight(['5c', '6s', '3s', '2s', '5s', '4s', '5d'], g);
console.log(st.isPossible, st.descr); // true "Straight, 6 High"
var tok = new ThreeOfAKind(['5c', '5s', '5h', '6c', 'Td', '9s', '2d'], g);
console.log(tok.isPossible, tok.descr); // true "Three of a Kind, 5's"
var tp = new TwoPair(['5c', '5d', '6s', '6c', 'Td', '9s', '2d'], g);
console.log(tp.isPossible, tp.descr); // true "Two Pair, 6's & 5's"
var op = new OnePair(['5h', '5c', '7s', '6c', 'Ts', '9s', '2d'], g);
console.log(op.isPossible, op.descr); // true "Pair, 5's"
var hc = new HighCard(['Kh', 'Tc', '5d', 'As', '3c', '3s', '2h'], g);
console.log(hc.isPossible, hc.descr); // true "A High"
```
--------------------------------
### Wild Card Handling Examples
Source: https://context7.com/goldfire/pokersolver/llms.txt
Demonstrates how the pokersolver library automatically resolves wild cards in different game types like 'joker' and 'deuceswild'. It shows how wild cards can complete straights, flushes, or act as specific ranks.
```APIDOC
## Wild Card Handling
Wild cards are resolved automatically per game rules. In `joker`, the joker card `'Or'` fills a straight/flush or becomes an Ace. In `deuceswild`, all `2x` cards are wild. In `paigowpokerfull/hi/lo`, `'Or'` completes straights/flushes or counts as Ace.
```javascript
var Hand = require('pokersolver').Hand;
var StraightFlush = require('pokersolver').StraightFlush;
var FiveOfAKind = require('pokersolver').FiveOfAKind;
var Game = require('pokersolver').Game;
var dwGame = new Game('deuceswild');
// Deuce completes a Straight Flush (outside gap)
var sf = new StraightFlush(['7s', '8s', '9s', 'Ts', '2c'], dwGame);
console.log(sf.isPossible); // true
console.log(sf.descr); // "Straight Flush, Js High"
// Two deuces make a Five of a Kind
var fok = new FiveOfAKind(['7h', '7d', '2s', '7s', '7c'], dwGame);
console.log(fok.isPossible); // true
console.log(fok.descr); // "Five of a Kind, 7's"
// Joker completes a Natural Royal Flush check
var jokerGame = new Game('joker');
var wrf = Hand.solve(['Ks', 'As', 'Js', 'Ts', 'Or'], jokerGame);
console.log(wrf.descr); // "Wild Royal Flush"
var nrf = Hand.solve(['Ks', 'As', 'Js', 'Ts', 'Qs'], jokerGame);
console.log(nrf.descr); // "Royal Flush" (no wild used)
```
```
--------------------------------
### Solve a Poker Hand with pokersolver
Source: https://context7.com/goldfire/pokersolver/llms.txt
Use Hand.solve() to analyze a set of cards and get the best possible hand. The 'game' parameter defaults to 'standard' and 'canDisqualify' can be set to true to filter out non-qualifying hands.
```javascript
var Hand = require('pokersolver').Hand;
// Texas Hold'em: 7 cards in, best 5-card hand out
var hand = Hand.solve(['Ad', 'As', 'Jc', 'Th', '2d', 'Qs', 'Qd']);
console.log(hand.name); // "Two Pair"
console.log(hand.descr); // "Two Pair, A's & Q's"
console.log(hand.rank); // 3 (rank within the standard hand hierarchy)
console.log(hand.toString()); // "Ad, As, Qd, Qs, Jc"
console.log(hand.toArray()); // ["Ad", "As", "Qd", "Qs", "Jc"]
```
```javascript
// 5-card hand
var hand5 = Hand.solve(['Kh', 'Kd', 'Kc', 'Ks', 'Ah']);
console.log(hand5.descr); // "Four of a Kind, K's"
```
```javascript
// Jacks or Better Video Poker with qualification
var Game = require('pokersolver').Game;
var vpHand = Hand.solve(['9c', '8d', '7h', '6s', '5c'], 'jacksbetter', true);
var winners = Hand.winners([vpHand]);
console.log(winners.length); // 0 — Straight qualifies (above Jacks), so length is 1
// For a non-qualifying hand:
var lowHand = Hand.solve(['3c', '3d', '7h', 'Ks', '2c'], 'jacksbetter', true);
console.log(Hand.winners([lowHand]).length); // 0 — Pair of 3's doesn't qualify
```
```javascript
// Royal Flush detection
var royal = Hand.solve(['As', 'Ks', 'Qs', 'Js', 'Ts', '2h', '5d']);
console.log(royal.descr); // "Royal Flush"
```
--------------------------------
### Get hand name and description
Source: https://github.com/goldfire/pokersolver/blob/master/README.md
Solve a hand and log its name and detailed description to the console. This is useful for displaying hand information to users.
```javascript
var hand = Hand.solve(['Ad', 'As', 'Jc', 'Th', '2d', 'Qs', 'Qd']);
console.log(hand.name); // Two Pair
console.log(hand.descr); // Two Pair, A's & Q's
```
--------------------------------
### Compare Poker Hands
Source: https://context7.com/goldfire/pokersolver/llms.txt
Use the `compare()` method to get a numerical result (-1, 0, or 1) indicating hand strength, or `loseTo()` for a boolean comparison. Useful for direct hand-vs-hand evaluation, including kicker comparisons.
```javascript
var Hand = require('pokersolver').Hand;
var strongHand = Hand.solve(['Ah', 'Kh', 'Qh', 'Jh', 'Th']); // Royal Flush
var weakHand = Hand.solve(['9h', '8h', '7h', '6h', '5h']); // Straight Flush, 9 High
console.log(strongHand.compare(weakHand)); // -1 (strongHand wins)
console.log(weakHand.compare(strongHand)); // 1 (weakHand loses)
console.log(strongHand.loseTo(weakHand)); // false
console.log(weakHand.loseTo(strongHand)); // true
// Kicker comparison
var OnePair = require('pokersolver').OnePair;
var Game = require('pokersolver').Game;
var g = new Game('standard');
var highKicker = new OnePair(['4d', '4h', 'Ah', 'Jc', 'Ts', '7s', '8d'], g);
var lowKicker = new OnePair(['4d', '4h', 'Ac', 'Tc', '9s', '7c', '8d'], g);
console.log(lowKicker.loseTo(highKicker)); // true — Jc kicker beats Tc
console.log(highKicker.loseTo(lowKicker)); // false
```
--------------------------------
### hand.compare(otherHand) / hand.loseTo(otherHand)
Source: https://context7.com/goldfire/pokersolver/llms.txt
Instance methods for direct two-hand comparison. `compare()` returns -1 (current wins), 0 (tie), or 1 (current loses). `loseTo()` is a convenience boolean wrapper.
```APIDOC
## hand.compare(otherHand) / hand.loseTo(otherHand)
Instance methods for direct two-hand comparison. `compare()` returns `-1` (current wins), `0` (tie), or `1` (current loses). `loseTo()` is a convenience boolean wrapper.
```javascript
var Hand = require('pokersolver').Hand;
var strongHand = Hand.solve(['Ah', 'Kh', 'Qh', 'Jh', 'Th']); // Royal Flush
var weakHand = Hand.solve(['9h', '8h', '7h', '6h', '5h']); // Straight Flush, 9 High
console.log(strongHand.compare(weakHand)); // -1 (strongHand wins)
console.log(weakHand.compare(strongHand)); // 1 (weakHand loses)
console.log(strongHand.loseTo(weakHand)); // false
console.log(weakHand.loseTo(strongHand)); // true
// Kicker comparison
var OnePair = require('pokersolver').OnePair;
var Game = require('pokersolver').Game;
var g = new Game('standard');
var highKicker = new OnePair(['4d', '4h', 'Ah', 'Jc', 'Ts', '7s', '8d'], g);
var lowKicker = new OnePair(['4d', '4h', 'Ac', 'Tc', '9s', '7c', '8d'], g);
console.log(lowKicker.loseTo(highKicker)); // true — Jc kicker beats Tc
console.log(highKicker.loseTo(lowKicker)); // false
```
```
--------------------------------
### Wild Card Handling in Deuces Wild and Joker Games
Source: https://context7.com/goldfire/pokersolver/llms.txt
Demonstrates how wild cards ('2' in Deuces Wild, 'Or' in Joker) are automatically resolved to complete hands like Straight Flushes, Five of a Kind, and Royal Flushes. Requires importing specific Hand types and Game configurations.
```javascript
var Hand = require('pokersolver').Hand;
var StraightFlush = require('pokersolver').StraightFlush;
var FiveOfAKind = require('pokersolver').FiveOfAKind;
var Game = require('pokersolver').Game;
var dwGame = new Game('deuceswild');
// Deuce completes a Straight Flush (outside gap)
var sf = new StraightFlush(['7s', '8s', '9s', 'Ts', '2c'], dwGame);
console.log(sf.isPossible); // true
console.log(sf.descr); // "Straight Flush, Js High"
// Two deuces make a Five of a Kind
var fok = new FiveOfAKind(['7h', '7d', '2s', '7s', '7c'], dwGame);
console.log(fok.isPossible); // true
console.log(fok.descr); // "Five of a Kind, 7's"
// Joker completes a Natural Royal Flush check
var jokerGame = new Game('joker');
var wrf = Hand.solve(['Ks', 'As', 'Js', 'Ts', 'Or'], jokerGame);
console.log(wrf.descr); // "Wild Royal Flush"
var nrf = Hand.solve(['Ks', 'As', 'Js', 'Ts', 'Qs'], jokerGame);
console.log(nrf.descr); // "Royal Flush" (no wild used)
```
--------------------------------
### Configure Poker Game Variants
Source: https://context7.com/goldfire/pokersolver/llms.txt
Instantiate the `Game` class or use its string name with `Hand.solve()` to adapt the solver to different poker variants. This affects hand ranking and wild card behavior.
```javascript
var Hand = require('pokersolver').Hand;
var Game = require('pokersolver').Game;
// --- Standard (Texas Hold'em, 7-Stud, 5-Draw) ---
var stdHand = Hand.solve(['5d', '5h', '5c', '5s', 'Kh'], 'standard');
console.log(stdHand.descr); // "Four of a Kind, 5's"
// --- Deuces Wild (deuces are wild, lowest qualifying = Three of a Kind) ---
var dwHand = Hand.solve(['Kh', 'As', '3c', '3s', '2h'], 'deuceswild');
console.log(dwHand.descr); // "Three of a Kind, 3's"
var dwNonQualify = Hand.solve(['5c', '4s', '4c', '3d', '3h'], 'deuceswild', true);
console.log(Hand.winners([dwNonQualify]).length); // 0 — Two Pair doesn't qualify
// --- Joker Poker (joker 'Or' completes straights/flushes or acts as Ace) ---
var jokerHand = Hand.solve(['Kh', 'Or', 'Qs', 'Td', '5s', '7c', '2h'], 'joker');
console.log(jokerHand.descr); // "A High" (joker becomes an Ace)
// --- Three Card Poker ---
var threeCard = Hand.solve(['Qh', 'Kd', 'As'], 'threecard');
console.log(threeCard.descr); // "A High"
var threeCardSF = Hand.solve(['9s', 'Ts', 'Js'], 'threecard');
console.log(threeCardSF.descr); // "Straight Flush, Js High"
// --- Four Card Poker ---
var fourCard = Hand.solve(['Ah', 'Ad', 'Ac', 'As'], 'fourcard');
console.log(fourCard.descr); // "Four of a Kind, A's"
// --- Game object properties ---
var g = new Game('standard');
console.log(g.cardsInHand); // 5
console.log(g.wildValue); // null
console.log(g.lowestQualified); // null
```
--------------------------------
### Solve and compare two poker hands
Source: https://github.com/goldfire/pokersolver/blob/master/README.md
Demonstrates solving two hands and determining the winner using Hand.winners. This is useful for comparing player hands in a game.
```javascript
var hand1 = Hand.solve(['Ad', 'As', 'Jc', 'Th', '2d', '3c', 'Kd']);
var hand2 = Hand.solve(['Ad', 'As', 'Jc', 'Th', '2d', 'Qs', 'Qd']);
var winner = Hand.winners([hand1, hand2]); // hand2
```
--------------------------------
### Include pokersolver in Browser
Source: https://context7.com/goldfire/pokersolver/llms.txt
Include the pokersolver script in your HTML file for browser usage.
```html
```
--------------------------------
### Hand.solve(cards, game?, canDisqualify?)
Source: https://context7.com/goldfire/pokersolver/llms.txt
Analyzes a pool of 3–7 cards and returns the best possible solved Hand object for the given game. The `game` parameter defaults to 'standard'. When `canDisqualify` is `true`, hands below the game's minimum qualifying rank are marked as non-qualifying and excluded from `Hand.winners()`.
```APIDOC
## Hand.solve(cards, game?, canDisqualify?)
### Description
Analyzes a pool of 3–7 cards and returns the best possible solved `Hand` object for the given game. The `game` parameter defaults to `'standard'`. When `canDisqualify` is `true`, hands below the game's minimum qualifying rank are marked as non-qualifying and excluded from `Hand.winners()`.
### Parameters
#### Path Parameters
- **cards** (Array) - Required - An array of card strings (e.g., 'Ad', 'Ts').
- **game** (string) - Optional - The name of the poker game rules to use (defaults to 'standard').
- **canDisqualify** (boolean) - Optional - If true, hands below the minimum qualifying rank are excluded from `Hand.winners()`.
### Request Example
```javascript
var Hand = require('pokersolver').Hand;
// Texas Hold'em: 7 cards in, best 5-card hand out
var hand = Hand.solve(['Ad', 'As', 'Jc', 'Th', '2d', 'Qs', 'Qd']);
console.log(hand.name); // "Two Pair"
console.log(hand.descr); // "Two Pair, A's & Q's"
console.log(hand.rank); // 3 (rank within the standard hand hierarchy)
console.log(hand.toString()); // "Ad, As, Qd, Qs, Jc"
console.log(hand.toArray()); // ["Ad", "As", "Qd", "Qs", "Jc"]
// 5-card hand
var hand5 = Hand.solve(['Kh', 'Kd', 'Kc', 'Ks', 'Ah']);
console.log(hand5.descr); // "Four of a Kind, K's"
// Jacks or Better Video Poker with qualification
var Game = require('pokersolver').Game;
var vpHand = Hand.solve(['9c', '8d', '7h', '6s', '5c'], 'jacksbetter', true);
var winners = Hand.winners([vpHand]);
console.log(winners.length); // 0 — Straight qualifies (above Jacks), so length is 1
// For a non-qualifying hand:
var lowHand = Hand.solve(['3c', '3d', '7h', 'Ks', '2c'], 'jacksbetter', true);
console.log(Hand.winners([lowHand]).length); // 0 — Pair of 3's doesn't qualify
// Royal Flush detection
var royal = Hand.solve(['As', 'Ks', 'Qs', 'Js', 'Ts', '2h', '5d']);
console.log(royal.descr); // "Royal Flush"
```
### Response
Returns a `Hand` object with properties like `name`, `descr`, `rank`, `toString()`, and `toArray()`.
```
--------------------------------
### PaiGowPokerHelper.setHands(hiHand, loHand)
Source: https://github.com/goldfire/pokersolver/blob/master/README.md
Sets the high and low hands for Pai Gow poker according to the provided card arrays and then solves both hands. This allows for manual setting of hands before solving.
```APIDOC
## PaiGowPokerHelper.setHands(hiHand, loHand)
### Description
Sets the hands according to the input, and solves both hands.
### Parameters
#### Path Parameters
* **hiHand** (Array) - Required - Five cards involved in the high hand, example: `['Ad', '2d', '3d', '4d', '7h']`.
* **loHand** (Array) - Required - Two cards involved in the low hand, example: `['Qc', 'Ks']`.
```
--------------------------------
### PaiGowPokerHelper.solve(cards)
Source: https://github.com/goldfire/pokersolver/blob/master/README.md
Solves a Pai Gow poker hand, sets it according to the 'House Way', and then solves both the high and low hands. This method is specifically for Pai Gow poker variations.
```APIDOC
## PaiGowPokerHelper.solve(cards)
### Description
Solves the hand passed in, sets it according to House Way, and solves both hands.
### Parameters
#### Path Parameters
* **cards** (Array) - Required - All cards involved in the hand, example: `['Ad', '2d', '3d', '4d', 'Qc', 'Ks', '7h']`.
```
--------------------------------
### PaiGowPokerHelper.solve(cards)
Source: https://context7.com/goldfire/pokersolver/llms.txt
Automatically splits a 7-card hand into the optimal 5-card high hand and 2-card low hand according to MGM Grand Casino House Way rules. Returns a PaiGowPokerHelper object with hiHand and loHand solved Hand properties.
```APIDOC
## PaiGowPokerHelper.solve(cards)
Accepts a 7-card hand and automatically splits it into the optimal 5-card high hand and 2-card low hand according to MGM Grand Casino House Way rules. Returns a `PaiGowPokerHelper` object with `hiHand` and `loHand` solved `Hand` properties.
```javascript
var PaiGowPokerHelper = require('pokersolver').PaiGowPokerHelper;
// House Way split
var hand = PaiGowPokerHelper.solve(['Ah', 'Ad', 'Or', 'As', 'Ac', 'Kh', 'Kd']);
console.log(hand.hiHand.descr); // "Five of a Kind, A's"
console.log(hand.loHand.descr); // "Pair, K's"
// Full House splits three to high, pair to low
var fhHand = PaiGowPokerHelper.solve(['Ah', 'Jh', 'Js', 'Jc', 'Or', '2d', 'Kh']);
console.log(fhHand.hiHand.descr); // "Three of a Kind, J's"
console.log(fhHand.loHand.descr); // "Pair, A's"
// Three Pair: top pair goes to low hand
var tpHand = PaiGowPokerHelper.solve(['Ac', 'As', '6h', '6c', '9d', '9h', 'Qs']);
console.log(tpHand.hiHand.descr); // "Two Pair, 9's & 6's"
console.log(tpHand.loHand.descr); // "Pair, A's"
// baseHand — the full 7-card hand evaluated as a unit
console.log(tpHand.baseHand.name); // "Three Pair"
```
```
--------------------------------
### Hand.solve(cards, game, canDisqualify)
Source: https://github.com/goldfire/pokersolver/blob/master/README.md
Solves a poker hand given an array of cards. It can evaluate hands of up to 7 cards and return detailed information about the hand's type, description, and score. It also supports different game rules and disqualification rules.
```APIDOC
## Hand.solve(cards, game, canDisqualify)
### Description
Solves the hand passed in, whether 3 cards or 7. Returns various information such as name, description, score and cards involved.
### Parameters
#### Path Parameters
* **cards** (Array) - Required - All cards involved in the hand, example: `['Ad', '2d', '3d', '4d', 'Qc', 'Ks', '7h']`. Note that a `10` should be passed as a `T` (`Th` for example).
* **game** (String) - Optional - Which rule set is used, based on the game being played. Default: 'standard'
* **canDisqualify** (Boolean) - Optional - Is this hand subject to qualification rules, which some games have? Default: false
```
--------------------------------
### Automatic Pai Gow Poker Hand Splitting (House Way)
Source: https://context7.com/goldfire/pokersolver/llms.txt
Uses PaiGowPokerHelper.solve() to automatically split a 7-card hand into a 5-card high hand and a 2-card low hand according to MGM Grand Casino House Way rules. Useful for standard Pai Gow gameplay.
```javascript
var PaiGowPokerHelper = require('pokersolver').PaiGowPokerHelper;
// House Way split
var hand = PaiGowPokerHelper.solve(['Ah', 'Ad', 'Or', 'As', 'Ac', 'Kh', 'Kd']);
console.log(hand.hiHand.descr); // "Five of a Kind, A's"
console.log(hand.loHand.descr); // "Pair, K's"
// Full House splits three to high, pair to low
var fhHand = PaiGowPokerHelper.solve(['Ah', 'Jh', 'Js', 'Jc', 'Or', '2d', 'Kh']);
console.log(fhHand.hiHand.descr); // "Three of a Kind, J's"
console.log(fhHand.loHand.descr); // "Pair, A's"
// Three Pair: top pair goes to low hand
var tpHand = PaiGowPokerHelper.solve(['Ac', 'As', '6h', '6c', '9d', '9h', 'Qs']);
console.log(tpHand.hiHand.descr); // "Two Pair, 9's & 6's"
console.log(tpHand.loHand.descr); // "Pair, A's"
// baseHand — the full 7-card hand evaluated as a unit
console.log(tpHand.baseHand.name); // "Three Pair"
```
--------------------------------
### Game class
Source: https://context7.com/goldfire/pokersolver/llms.txt
Encapsulates the rule set for a specific poker variant. Pass a `Game` instance (or its string name) as the second argument to `Hand.solve()` to switch games. Supported descriptors: `'standard'`, `'jacksbetter'`, `'joker'`, `'deuceswild'`, `'threecard'`, `'fourcard'`, `'fourcardbonus'`, `'paigowpokerfull'`, `'paigowpokerhi'`, `'paigowpokerlo'`.
```APIDOC
## Game class
Encapsulates the rule set for a specific poker variant. Pass a `Game` instance (or its string name) as the second argument to `Hand.solve()` to switch games. Supported descriptors: `'standard'`, `'jacksbetter'`, `'joker'`, `'deuceswild'`, `'threecard'`, `'fourcard'`, `'fourcardbonus'`, `'paigowpokerfull'`, `'paigowpokerhi'`, `'paigowpokerlo'`.
```javascript
var Hand = require('pokersolver').Hand;
var Game = require('pokersolver').Game;
// --- Standard (Texas Hold'em, 7-Stud, 5-Draw) ---
var stdHand = Hand.solve(['5d', '5h', '5c', '5s', 'Kh'], 'standard');
console.log(stdHand.descr); // "Four of a Kind, 5's"
// --- Deuces Wild (deuces are wild, lowest qualifying = Three of a Kind) ---
var dwHand = Hand.solve(['Kh', 'As', '3c', '3s', '2h'], 'deuceswild');
console.log(dwHand.descr); // "Three of a Kind, 3's"
var dwNonQualify = Hand.solve(['5c', '4s', '4c', '3d', '3h'], 'deuceswild', true);
console.log(Hand.winners([dwNonQualify]).length); // 0 — Two Pair doesn't qualify
// --- Joker Poker (joker 'Or' completes straights/flushes or acts as Ace) ---
var jokerHand = Hand.solve(['Kh', 'Or', 'Qs', 'Td', '5s', '7c', '2h'], 'joker');
console.log(jokerHand.descr); // "A High" (joker becomes an Ace)
// --- Three Card Poker ---
var threeCard = Hand.solve(['Qh', 'Kd', 'As'], 'threecard');
console.log(threeCard.descr); // "A High"
var threeCardSF = Hand.solve(['9s', 'Ts', 'Js'], 'threecard');
console.log(threeCardSF.descr); // "Straight Flush, Js High"
// --- Four Card Poker ---
var fourCard = Hand.solve(['Ah', 'Ad', 'Ac', 'As'], 'fourcard');
console.log(fourCard.descr); // "Four of a Kind, A's"
// --- Game object properties ---
var g = new Game('standard');
console.log(g.cardsInHand); // 5
console.log(g.wildValue); // null
console.log(g.lowestQualified); // null
```
```
--------------------------------
### PaiGowPokerHelper.winners(player, banker)
Source: https://github.com/goldfire/pokersolver/blob/master/README.md
Compares the player's and banker's Pai Gow poker hands to determine the winner. It returns a numerical value indicating the outcome: 1 for Player win, -1 for Banker win, and 0 for a Push.
```APIDOC
## PaiGowPokerHelper.winners(player, banker)
### Description
Compare the passed PaiGowPokerHelper hands and determine who wins. 1 = Player, -1 = Banker, 0 = Push.
### Parameters
#### Path Parameters
* **player** (PaiGowPokerHelper) - Required - Non-banking hand solved with `PaiGowPokerHelper.solve` or `PaiGowPokerHelper.setHands`.
* **banker** (PaiGowPokerHelper) - Required - Banking hand solved with `PaiGowPokerHelper.solve` or `PaiGowPokerHelper.setHands`.
```
--------------------------------
### Server-side usage with require
Source: https://github.com/goldfire/pokersolver/blob/master/README.md
Import the Hand object for use in Node.js environments.
```javascript
var Hand = require('pokersolver').Hand;
```
--------------------------------
### Hand.winners(hands)
Source: https://context7.com/goldfire/pokersolver/llms.txt
Compares an array of solved Hand objects and returns an array of the winning hand(s). Hands that do not meet the game's qualification rules are automatically filtered out. Returns multiple hands if there is a tie.
```APIDOC
## Hand.winners(hands)
### Description
Compares an array of solved `Hand` objects and returns an array of the winning hand(s). Hands that do not meet the game's qualification rules are automatically filtered out. Returns multiple hands if there is a tie.
### Parameters
#### Path Parameters
- **hands** (Array) - Required - An array of solved `Hand` objects to compare.
### Request Example
```javascript
var Hand = require('pokersolver').Hand;
var h1 = Hand.solve(['Ad', 'As', 'Jc', 'Th', '2d', '3c', 'Kd']); // Pair, A's
var h2 = Hand.solve(['Ad', 'As', 'Jc', 'Th', '2d', 'Qs', 'Qd']); // Two Pair, A's & Q's
var h3 = Hand.solve(['7h', '7d', '7c', '7s', 'Kh', 'Qd', 'Jc']); // Four of a Kind, 7's
var winner = Hand.winners([h1, h2, h3]);
console.log(winner.length); // 1
console.log(winner[0] === h3); // true
console.log(winner[0].descr); // "Four of a Kind, 7's"
// Tie detection
var tie1 = Hand.solve(['2s', '3s', '4h', '5c', 'As', 'Ts', '8d']); // Straight, Wheel
var tie2 = Hand.solve(['2h', '3h', '4d', '5d', 'Ah', 'Tc', '8c']); // Straight, Wheel
var tie3 = Hand.solve(['5s', 'Ts', '3h', 'Ac', '2s', 'Tc', '8d']); // Pair, T's
var ties = Hand.winners([tie1, tie2, tie3]);
console.log(ties.length); // 2
console.log(ties.indexOf(tie1) >= 0); // true — both straights tie
console.log(ties.indexOf(tie2) >= 0); // true
console.log(ties.indexOf(tie3) >= 0); // false
```
### Response
Returns an array of `Hand` objects representing the winning hand(s). If there is a tie, multiple `Hand` objects will be returned.
```
--------------------------------
### Manual Pai Gow Poker Hand Splitting
Source: https://context7.com/goldfire/pokersolver/llms.txt
Utilizes PaiGowPokerHelper.setHands() to manually define the 5-card high and 2-card low hands, bypassing House Way rules. This is useful for custom splitting logic or player-defined strategies. The hi hand must be higher than the lo hand for a valid split.
```javascript
var PaiGowPokerHelper = require('pokersolver').PaiGowPokerHelper;
// Manual split using card arrays
var hand = PaiGowPokerHelper.setHands(
['Kh', 'Or', 'Qs', 'Td', '5s'], // 5-card hi
['7c', '2h'] // 2-card lo
);
console.log(hand.hiHand.descr); // "A High" (joker becomes Ace)
console.log(hand.loHand.descr); // "7 High"
// qualifiesValid() — hi hand must beat lo hand, otherwise player is disqualified
console.log(hand.qualifiesValid()); // true
// Invalid set: lo hand beats hi hand
var invalid = PaiGowPokerHelper.setHands(
['Kh', '7c', 'Qs', 'Td', '5s'],
['Ac', '2h'] // Ace-high lo beats King-high hi
);
console.log(invalid.qualifiesValid()); // false
```
--------------------------------
### Inspect Solved Hand Properties
Source: https://context7.com/goldfire/pokersolver/llms.txt
Access properties like name, description, rank, and the cards that form the winning hand after solving. Also shows how to access properties of individual Card objects.
```javascript
var Hand = require('pokersolver').Hand;
var hand = Hand.solve(['Qd', 'Jd', 'Td', '9d', '8d', 'As', '2c']);
// hand.name — short hand type name
console.log(hand.name); // "Straight Flush"
// hand.descr — detailed description
console.log(hand.descr); // "Straight Flush, Qd High"
// hand.rank — numeric rank (higher is better, game-relative)
console.log(hand.rank); // 9 (Straight Flush in standard)
// hand.cards — Array of Card objects forming the winning hand (max 5)
console.log(hand.cards.length); // 5
console.log(hand.cards[0].toString()); // "Qd"
// hand.cardPool — full array of all input Card objects, sorted descending
console.log(hand.cardPool.length); // 7
// hand.toString() — comma-separated string of winning cards
console.log(hand.toString()); // "Qd, Jd, 10d, 9d, 8d"
// hand.toArray() — array of winning card strings
console.log(hand.toArray()); // ["Qd", "Jd", "10d", "9d", "8d"]
// Card object properties
var card = hand.cards[0];
console.log(card.value); // "Q"
console.log(card.suit); // "d"
console.log(card.rank); // 11 (index in the internal values array)
console.log(card.wildValue); // "Q" (same as value unless wild)
```
--------------------------------
### Browser usage with script tag
Source: https://github.com/goldfire/pokersolver/blob/master/README.md
Include the pokersolver script in your HTML for browser-based applications. You can then access the Hand object globally.
```html
```
--------------------------------
### Hand.winners(hands)
Source: https://github.com/goldfire/pokersolver/blob/master/README.md
Compares multiple solved hands and determines the winning hand(s). This method is useful for comparing hands in a game and can return multiple hands in case of a tie.
```APIDOC
## Hand.winners(hands)
### Description
Compare the passed hands and determine which is the best hand(s). Can return multiple if there is a tie.
### Parameters
#### Path Parameters
* **hands** (Array) - Required - All hands solved with `Hand.solve` that should be compared.
```
--------------------------------
### Solved Hand Properties
Source: https://context7.com/goldfire/pokersolver/llms.txt
After solving a hand, you can access various properties to inspect the result, such as the hand name, description, rank, and the cards that form the winning hand.
```APIDOC
## Solved Hand Properties
After calling `Hand.solve()`, the returned object exposes several properties for inspecting the result.
```javascript
var Hand = require('pokersolver').Hand;
var hand = Hand.solve(['Qd', 'Jd', 'Td', '9d', '8d', 'As', '2c']);
// hand.name — short hand type name
console.log(hand.name); // "Straight Flush"
// hand.descr — detailed description
console.log(hand.descr); // "Straight Flush, Qd High"
// hand.rank — numeric rank (higher is better, game-relative)
console.log(hand.rank); // 9 (Straight Flush in standard)
// hand.cards — Array of Card objects forming the winning hand (max 5)
console.log(hand.cards.length); // 5
console.log(hand.cards[0].toString()); // "Qd"
// hand.cardPool — full array of all input Card objects, sorted descending
console.log(hand.cardPool.length); // 7
// hand.toString() — comma-separated string of winning cards
console.log(hand.toString()); // "Qd, Jd, 10d, 9d, 8d"
// hand.toArray() — array of winning card strings
console.log(hand.toArray()); // ["Qd", "Jd", "10d", "9d", "8d"]
// Card object properties
var card = hand.cards[0];
console.log(card.value); // "Q"
console.log(card.suit); // "d"
console.log(card.rank); // 11 (index in the internal values array)
console.log(card.wildValue); // "Q" (same as value unless wild)
```
```
--------------------------------
### Hand.toString()
Source: https://github.com/goldfire/pokersolver/blob/master/README.md
Returns a formatted string representation of the cards that make up the identified hand type. This is typically a maximum of 5 cards.
```APIDOC
## Hand.toString()
### Description
Returns a formatted string of all cards involved in the identified hand type (maximum of 5 cards).
```
--------------------------------
### Determine Winning Hands with Hand.winners()
Source: https://context7.com/goldfire/pokersolver/llms.txt
Compare multiple solved Hand objects to find the winner(s). This function automatically filters out hands that do not meet qualification rules and correctly identifies ties.
```javascript
var Hand = require('pokersolver').Hand;
var h1 = Hand.solve(['Ad', 'As', 'Jc', 'Th', '2d', '3c', 'Kd']); // Pair, A's
var h2 = Hand.solve(['Ad', 'As', 'Jc', 'Th', '2d', 'Qs', 'Qd']); // Two Pair, A's & Q's
var h3 = Hand.solve(['7h', '7d', '7c', '7s', 'Kh', 'Qd', 'Jc']); // Four of a Kind, 7's
var winner = Hand.winners([h1, h2, h3]);
console.log(winner.length); // 1
console.log(winner[0] === h3); // true
console.log(winner[0].descr); // "Four of a Kind, 7's"
```
```javascript
// Tie detection
var tie1 = Hand.solve(['2s', '3s', '4h', '5c', 'As', 'Ts', '8d']); // Straight, Wheel
var tie2 = Hand.solve(['2h', '3h', '4d', '5d', 'Ah', 'Tc', '8c']); // Straight, Wheel
var tie3 = Hand.solve(['5s', 'Ts', '3h', 'Ac', '2s', 'Tc', '8d']); // Pair, T's
var ties = Hand.winners([tie1, tie2, tie3]);
console.log(ties.length); // 2
console.log(ties.indexOf(tie1) >= 0); // true — both straights tie
console.log(ties.indexOf(tie2) >= 0); // true
console.log(ties.indexOf(tie3) >= 0); // false
```
--------------------------------
### Pai Gow Poker Winner Determination
Source: https://context7.com/goldfire/pokersolver/llms.txt
Compares a player's split hand against a banker's split hand using PaiGowPokerHelper.winners(). It returns 1 for player win, -1 for banker win, and 0 for a push. Banker wins all ties.
```javascript
var PaiGowPokerHelper = require('pokersolver').PaiGowPokerHelper;
// Player wins both hi and lo
var player = PaiGowPokerHelper.setHands(['Kh', 'Kc', '7s', 'Td', '5s'], ['Ac', 'Qh']);
var banker = PaiGowPokerHelper.solve(['8h', '8c', '4s', 'Ad', 'Js', '7c', '2h']);
console.log(PaiGowPokerHelper.winners(player, banker)); // 1
// Banker takes ties — identical hands resolve to banker win
var tiePlayer = PaiGowPokerHelper.setHands(['Kh', 'Kc', '7s', 'Td', '5s'], ['Ac', 'Qh']);
var tieBanker = PaiGowPokerHelper.solve(['Ah', 'Qc', 'Ks', 'Kd', 'Ts', '7c', '5h']);
console.log(PaiGowPokerHelper.winners(tiePlayer, tieBanker)); // -1 (banker takes tie)
// Push — player wins one, banker wins the other
var pushPlayer = PaiGowPokerHelper.setHands(['Kh', 'Kc', '7s', 'Td', '6s'], ['Ac', 'Jh']);
var pushBanker = PaiGowPokerHelper.solve(['Ah', 'Qc', 'Ks', 'Kd', 'Ts', '7c', '5h']);
console.log(PaiGowPokerHelper.winners(pushPlayer, pushBanker)); // 0
// Disqualification — player set lo > hi, banker auto-wins
var disqPlayer = PaiGowPokerHelper.setHands(['Kh', '7c', 'Qs', 'Td', '5s'], ['Ac', '2h']);
var validBanker = PaiGowPokerHelper.solve(['8h', '9c', '4s', '3d', '5s', '7c', '2h']);
console.log(PaiGowPokerHelper.winners(disqPlayer, validBanker)); // -1
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.