Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

poker-odds

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

poker-odds

A lightweight command line tool for calculating poker hand probabilities

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
128
decreased by-3.03%
Maintainers
1
Weekly downloads
 
Created
Source

poker-odds

Latest npm version Node version required Build Status Test Coverage Donate

A lightweight command line tool for calculating poker hand probabilities. No dependencies. No huge data files.

Installation

# yarn
yarn global add poker-odds

# npm
npm install -g poker-odds

Usage

poker-odds AcKh KdQs   # any number of hands supported
                       # use .. for random cards, .... for a random hand

# options
-b, --board Td7s8d     # community cards
-i, --iterations 1000  # number of preflop simulations to run, default: 100000
-e, --exhaustive       # run all preflop simulations
-p, --possibilities    # show individual hand possibilities
-n, --no-color         # disable color output
-v, --version          # show version
-h, --help             # show help

Use --board or -b to define community cards.

--board example

Use --exhaustive or -e to run all preflop simulations. Note that this will take some time.

--exhaustive example

Use --possibilities or -p to show all possible hand outcomes. Hand possibilities are shown by default if only one hand is defined.

--possibilities example

API

The method used to calculate probabilities can be imported and used directly in a JS/node project:

import { calculateEquity } from 'poker-odds'

const hands = [['As', 'Kh'], ['Kd', 'Qs']]
const board = ['Td', '7s', '8d']
const iterations = 100000 // optional
const exhaustive = false // optional

calculateEquity(hands, board, iterations, exhaustive)

calculateEquity() returns an array of hands with the results of the simulations:

[
  {
    "hand": [
      "Ac",
      "Kh"
    ],
    "count": 990,
    "wins": 803,
    "ties": 15,
    "handChances": [
      { "name": "high card", "count": 376 },
      { "name": "one pair", "count": 479 },
      { "name": "two pair", "count": 78 },
      { "name": "three of a kind", "count": 13 },
      { "name": "straight", "count": 44 },
      { "name": "flush", "count": 0 },
      { "name": "full house", "count": 0 },
      { "name": "four of a kind", "count": 0 },
      { "name": "straight flush", "count": 0 },
      { "name": "royal flush", "count": 0 }
    ],
    "favourite": true
  },
  {
    "hand": [
      "Kd",
      "Qs"
    ],
    "count": 990,
    "wins": 172,
    "ties": 15,
    "handChances": [
      { "name": "high card", "count": 351 },
      { "name": "one pair", "count": 463 },
      { "name": "two pair", "count": 77 },
      { "name": "three of a kind", "count": 13 },
      { "name": "straight", "count": 41 },
      { "name": "flush", "count": 45 },
      { "name": "full house", "count": 0 },
      { "name": "four of a kind", "count": 0 },
      { "name": "straight flush", "count": 0 },
      { "name": "royal flush", "count": 0 }
    ],
    "favourite": false
  }
]

FAQs

Package last updated on 30 Jan 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc