poker-tools
This library is a fork of the excellent poker-odds-calculator library by rundef.
The changes are:
- Converted to ES6 from TypeScript.
- Removed the Array subclassing since this is not yet widely supported.
- Exposed another utility function
calculateWinner([cardgroups], board)
.
Only Texas Hold'em is supported.
What can you do with this library:
- Calculate equities of hands given a board (optional)
- Calculate the winner of a set of hands given a board (optional)
Example code:
; const player1Cards = CardGroup;const player2Cards = CardGroup;const board = CardGroup;const board2 = CardGroup; const result = OddsCalculator; console;console;console; const result = OddsCalculator; console;
Output:
Player #1 - Jh Js - 75%
Player #2 - Jd Qc - 24%
Tie - Jd Qc - 1%
[ [ { index: 0, handrank: [Object] },
{ index: 1, handrank: [Object] } ] ]
Note that calculateWinner
returns an array or arrays to support sidepots. Hands in the same array have the same rank.