npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

poker-odds-calculator

v0.3.1

Published

A pre-flop and post-flop odds calculator for Texas Holdem

Downloads

607

Readme

Poker Odds Calculator

Build Status Coverage Status Latest Stable Version

A pre-flop and post-flop odds calculator for Texas Holdem.

Installation

npm install poker-odds-calculator

Console Usage

Pre-flop odds

Let's say that we want to know the odds of 3 pre-flop all-in players holding the following hands: J♥J♤ vs T♢T♤ vs A♧K♧ :

node_modules/.bin/poker-odds-calculator JhJs TdTs AcKc

Post-flop odds

Let's say that we want to know the odds of a player holding the J♢ and the Q♢ against a player with the J♥ and the J♤ on a 7♢9♢T♤ board, with 2 cards to come :

node_modules/.bin/poker-odds-calculator -b 7d9dTs JhJs JdQd
node_modules/.bin/poker-odds-calculator --board 7d9dTs7s JhJs JdQd

-b denotes the board

Short deck

To calculate odds for short deck, override the game variant with -g

node_modules/.bin/poker-odds-calculator -g short -b 7d9dTs JhJs JdQd
node_modules/.bin/poker-odds-calculator --game short --board 7d9dTs7s JhJs JdQd

API Usage

Let's take the previous example, but use the API instead:

import {CardGroup, OddsCalculator} from 'poker-odds-calculator';

const player1Cards = CardGroup.fromString('JhJs');
const player2Cards = CardGroup.fromString('JdQd');
const board = CardGroup.fromString('7d9dTs');

const result = OddsCalculator.calculate([player1Cards, player2Cards], board);

console.log(`Player #1 - ${player1Cards} - ${result.equities[0].getEquity()}%`);
console.log(`Player #2 - ${player2Cards} - ${result.equities[1].getEquity()}%`);

To use Short Deck:

const result = OddsCalculator.calculate([player1Cards, player2Cards], board, 'short');

License

This project is licensed under the MIT License - see the LICENSE.md file for details.