0.2.6 • Published 3 years ago

straddle v0.2.6

Weekly downloads
1
License
MIT
Repository
-
Last release
3 years ago

Straddle

Poker hand evaluator in TypeScript.

npm install straddle
# or
yarn add straddle
const deck = new Deck() // create and shuffle the deck
const hand = deck.draw(2) // draw 2 cards from deck
Card.printPrettyCards(hand) // print the hand: [8♣️] [3♦️]
const board = deck.draw(5)
const evaluator = new Evaluator()
let score = evaluator.evaluate(hand, board) // evaluate best hand

score = evaluator.evaluate(
  [Card.new('Ah'), Card.new('Kh')], // create card directly
  [Card.new('Qh'), Card.new('Jh'), Card.new('Th')]
)
// {
//   score: 1,
//   hand: [ 268446761, 134228773, 67119647, 33564957, 16787479 ],
//   handStr: [ 'Ah', 'Kh', 'Qh', 'Jh', 'Th' ],
//   handPrettyStr: [ '[A♥️]', '[K♥️]', '[Q♥️]', '[J♥️]', '[T♥️]' ],
//   handName: 'Royal 👑 Flush'
// }
0.2.6

3 years ago

0.2.5

3 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago