Giter Club home page Giter Club logo

node-poker-odds-calculator's Introduction

Poker Odds Calculator

Build Status Coverage Status Latest Stable Version

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

For a live demonstration of this library in action, check out shortdeck.gg!

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.

node-poker-odds-calculator's People

Contributors

dheffx avatar rundef avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.