Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/thlorenz/hha

Poker HandHistory Analyzer
https://github.com/thlorenz/hha

Last synced: 2 months ago
JSON representation

Poker HandHistory Analyzer

Awesome Lists containing this project

README

        

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

Poker HandHistory Analyzer

## Status

Analyzes holdem hands.

- [Installation](#installation)
- [API](#api)
- [analyze](#analyze)
- [filterInactives](#filterinactives)
- [hha.script](#hhascript)
- [hha.storyboard](#hhastoryboard)
- [hha.summary](#hhasummary)
- [License](#license)

## Installation

npm install hha

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

### analyze

Analyzes a given PokerHand which has been parsed by the HandHistory Parser hhp.
Relative player positions are calculated, i.e. cutoff, button, etc.
Players are included in order of action on flop.

The analyzed hand then can be visualized by [hhv](https://github.com/thlorenz/hhv).

For an example of an analyzed hand please view [json output of an analyzed
hand](https://github.com/thlorenz/hhv/blob/master/test/fixtures/holdem/actiononall.json).

**Parameters**

- `hand` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** hand history as parsed by [hhp](https://github.com/thlorenz/hhp)

Returns **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** the analyzed hand

### filterInactives

Filters all players who didn't act in the hand or just folded.

**Parameters**

- `players` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)>** all players in the hand

Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)>** all players that were active in the hand

### hha.script

Scripts what happened in a hand into a actions script array.
This array can be read top down to replay the hand.

The players and info fields from the analyzed data are copied over.
Each action includes the index at which the player that's executing
the action can be found in the players array.

Structure of returned object:

info: object containing hand info
table: object containing info about the table like total seats
board: object cards on the board
players: array of all players at the table including all info about their stacks
actions:
preflop : array of preflop actions
flop : array of flop actions
turn : array of turn actions
river : array of river actions
showdown : array of showdown actions

**Parameters**

- `data` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** analyzed hand data @see hha()

Returns **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**

### hha.storyboard

Takes a script of actions and calculates the states for each.
Adds pointers to the state at the beginning of each script.

This is useful if you try to jump around in the hand and reset
the state of the table.

**Parameters**

- `script` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** created via @see hha:script

### hha.summary

Converts a hand that was analyzed and then scripted to a summary representation.

The summary has the following properties:

- header: contains game info, like room, pokertype, blinds, etc.
- seats: lists the seats of the players including pos, chips and hero indicators
- chipsStackRatio: hero's M for tournaments, his BBs for cash games
- preflopSummary: hero's cards and position
- preflopActions: action types + amounts of each player by position
- flopSummary: pot at flop, board and playersInvolved
- flopActions: same as preflopActions
- turnSummary: pot at turn, turn card and playersInvolved
- turnActions: same as preflopActions
- riverSummary: pot at river, river card and playersInvolved
- riverActions: same as preflopActions
- totalPot: total money in the pot
- spoilers: players whos cards are known by position

**Parameters**

- `script` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**

Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** the hand summarized

## License

MIT