Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/thlorenz/hhp

Poker HandHistory Parser
https://github.com/thlorenz/hhp

Last synced: 15 days ago
JSON representation

Poker HandHistory Parser

Awesome Lists containing this project

README

        

# hhp [![build status](https://secure.travis-ci.org/thlorenz/hhp.svg)](http://travis-ci.org/thlorenz/hhp)

become a patron

Poker HandHistory Parser

## Status

Parses PokerStars, Ignition, PartyPoker and Pacific (888) Hold'em hands, tourneys, SNGs and Cash.

## Installation

npm install hhp

## [API](https://thlorenz.github.io/hhp)

### parseHand

Parses PokerHand Histories as output by the given online Poker Rooms.
Autodetects the game type and the PokerRoom.

The parsed hands can then be further analyzed with the
[hha](https://github.com/thlorenz/hha) module.

As an example [this
hand](https://github.com/thlorenz/hhp/blob/master/test/fixtures/holdem/pokerstars/actiononall.txt)
is parsed into [this object
representation](https://github.com/thlorenz/hha/blob/master/test/fixtures/holdem/actiononall.json).

**Parameters**

- `input` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** the textual representation of one poker hand as written to the HandHistory folder
- `opts` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?** various options
- `opts.infoOnly` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** denotes that only the header line of the hand is parsed and only the info object returned
- `opts.buyinFile` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** file name overrides buyin for rooms that don't include it in the history like Ignition

Returns **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** representation of the given hand to be used as input for other tools like hha

### canParse

Determines if any of the parsers can parse the passed hand(s).

**Parameters**

- `input` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** to parse

Returns **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** `true` if it knows how to parse this text

### extractHands

Extracts all hands from a given text file.

**Parameters**

- `txt` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** the text containing the hands

Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)>** an array of hands, each hand split into lines

### parseHands

Parses multiple hands from a given text.

**Parameters**

- `input` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** the textual representation of the poker hands as written to the HandHistory folder
- `opts` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?** various options, passed along to `parseHand`

Returns **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** parsed hands and errors encountered: `{ parsedHands: Array, errors: Array, count: Number }`

## License

MIT