hoyle

0.3.0 • Public • Published

Build Status

Hoyle

Hoyle

A Javascript poker hand evaluator (Written in Coffeescript)

Example

Hand = require('hoyle').Hand

describe "Finding winning hands", ->
  it "should detect the winning hand from a list", ->
    gary = Hand.make(["2s","3s","4h","5c","As","Ts","8d"])
    mike = Hand.make(["5s","Ts","3h","Ac","2s","Ts","8d"])
    steve = Hand.make(["5s","5h","3s","3c","2s","Ts","3d"])
    winners = Hand.pickWinners([gary, mike, steve])
    winners.length.should.equal 1
    winners[0].should.equal steve
    winners[0].name.should.equal "Full house"

Install

npm install hoyle

Install and use locally

git clone git://github.com/mdp/hoyle.git
cd hoyle
npm install
npm run-script prepublish
npm link

Testing

npm install
npm test

Notes

  • Handles making the best poker hand out of 5-7 cards
  • Written for code clarity, not speed (But still plenty fast for many uses) See "The Great Poker Hand Evaluator Roundup" for a deeper dive into speedy poker hand evaluators.

Package Sidebar

Install

npm i hoyle

Weekly Downloads

6

Version

0.3.0

License

MIT

Unpacked Size

62.8 kB

Total Files

15

Last publish

Collaborators

  • mdp