Coder Social home page Coder Social logo

apqrs / poker-odds-calc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from siavashg87/poker-odds-calc

0.0 0.0 0.0 72 KB

Fastest and most accurate node module for calculating odds of poker games Texas Hold'em, Texas Shortdeck/Sixplus and Omaha.

License: MIT License

JavaScript 5.09% TypeScript 94.91%

poker-odds-calc's Introduction

Poker Odds Calc

Build Status Node version required Latest Stable Version

Fastest and most accurate node module for calculating odds of poker games Texas Hold'em, Texas Shortdeck/Sixplus and Omaha.

Installation

npm install -g poker-odds-calc

Usage

poker-odds-calc -p AdKh -p AcKh -b 5sTd9c

# options
-g, --game texas_holdem     # Select between texas_holdem, shortdeck_holdem and omaha. Default texas_holdem.
-b, --board 5sTd9cTh        # Define community cards.
-p, --player AcKh           # Define any number of player hand.
-l, --limit 1000            # Limit number of iterations. Default 100,000.
-e, --exhaustive            # Run all possible board combinations, regardless limit option.
-d, --dead 2s2d             # Dead card(s) to exclude from calculation.
--tripsbeatstraight         # Option only available for -g shortdeck_holdem
-h, --help                  # Show help

poker-odds-calc -p QsKs -p QdKd -b JsTs5hTd

--example

API Usage

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

import {TexasHoldem, SixPlusHoldem, Omaha} from './index';

const Table = new TexasHoldem();
Table
  .addPlayer(["Qs", "Ks"])
  .addPlayer(["Qd", "Kd"])

  .setBoard(["Js","Ts","5h","Td"])
  // or
  .boardAction(board => {
    board
      .setFlop(["Js", "Ts", "5h"])
      .setTurn("Td")
  })
  ;

const Result = Table.calculate();

Result.getPlayers().forEach(player => {
  console.log(`${player.getName()} - ${player.getHand()} - Wins: ${player.getWinsPercentageString()} - Ties: ${player.getTiesPercentageString()}`);
});

console.log(`Board: ${Result.getBoard()}`);
console.log(`Iterations: ${Result.getIterations()}`);
console.log(`Time takes: ${Result.getTime()}ms`);

// Outputs:
// Player #1 - QsKs - Wins: 20.45% - Ties: 79.55%
// Player #2 - QdKd - Wins: 0.00% - Ties: 79.55%
// Board: JsTs5hTd
// Iterations: 44
// Time takes: 8ms

License

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

poker-odds-calc's People

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.