holdem-eval

0.1.2 • Public • Published

holdem-eval

🍀 Texas Holdem Hand Evaluator

features

  • typescript strict syntax
  • full functional syntax with ramdajs
  • jest testing

installation

$ npm install holdem-eval --save
or
$ yarn add holdem-eval

development

$ yarn
$ yarn test

usage

// in javascript

> const { Hand } = require('holdem-eval')
>
> const hand1 = Hand.make(["5s", "5c", "7s", "7c", "Ts", "Ts", "2d"])
> console.log(hand1)
{ cardPool: 
   [ { rank: 9, value: 'T', suit: 'S' },
     { rank: 9, value: 'T', suit: 'S' },
     { rank: 6, value: '7', suit: 'S' },
     { rank: 6, value: '7', suit: 'C' },
     { rank: 4, value: '5', suit: 'S' },
     { rank: 4, value: '5', suit: 'C' },
     { rank: 1, value: '2', suit: 'D' } ],
cards: 
   [ { rank: 9, value: 'T', suit: 'S' },
     { rank: 9, value: 'T', suit: 'S' },
     { rank: 6, value: '7', suit: 'S' },
     { rank: 6, value: '7', suit: 'C' },
     { rank: 4, value: '5', suit: 'S' } ],
name: 'Two Pair',
rank: 2 }
> const h1 = Hand.make(["2s", "3s", "4h", "5c", "As", "Ts", "8d"])
> const h2 = Hand.make(["5s", "Ts", "3h", "Ac", "2s", "Ts", "8d"])
> const h3 = Hand.make(["5s", "5h", "3s", "3c", "2s", "Ts", "3d"])
> const winners = Hand.pickWinners(h1, h2, h3)
> console.log(winners)
[ { cardPool: 
     [ [Object],
       [Object],
       [Object],
       [Object],
       [Object],
       [Object],
       [Object] ],
    cards: [ [Object], [Object], [Object], [Object], [Object] ],
    name: 'Full House',
    rank: 6 } ]

// in typescript

> import * as Hand from 'holdem-eval'

Readme

Keywords

Package Sidebar

Install

npm i holdem-eval

Weekly Downloads

1

Version

0.1.2

License

MIT

Unpacked Size

177 kB

Total Files

14

Last publish

Collaborators

  • laberin