{"id":16804891,"url":"https://github.com/cookpete/poker-odds","last_synced_at":"2025-04-07T15:07:41.724Z","repository":{"id":40789287,"uuid":"119521906","full_name":"cookpete/poker-odds","owner":"cookpete","description":"A lightweight command line tool for calculating poker hand probabilities","archived":false,"fork":false,"pushed_at":"2022-12-07T00:02:07.000Z","size":671,"stargazers_count":172,"open_issues_count":16,"forks_count":23,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-31T12:05:01.513Z","etag":null,"topics":["chance","equity","hand","poker","probabilities","simulation","texas-holdem"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cookpete.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-30T10:40:24.000Z","updated_at":"2025-02-13T00:10:04.000Z","dependencies_parsed_at":"2023-01-24T12:31:58.629Z","dependency_job_id":null,"html_url":"https://github.com/cookpete/poker-odds","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cookpete%2Fpoker-odds","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cookpete%2Fpoker-odds/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cookpete%2Fpoker-odds/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cookpete%2Fpoker-odds/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cookpete","download_url":"https://codeload.github.com/cookpete/poker-odds/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247675597,"owners_count":20977376,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chance","equity","hand","poker","probabilities","simulation","texas-holdem"],"created_at":"2024-10-13T09:46:24.379Z","updated_at":"2025-04-07T15:07:41.701Z","avatar_url":"https://github.com/cookpete.png","language":"JavaScript","funding_links":["https://paypal.me/ckpt"],"categories":[],"sub_categories":[],"readme":"# poker-odds\n\n[![Latest npm version](https://img.shields.io/npm/v/poker-odds.svg)](https://www.npmjs.com/package/poker-odds)\n[![Node version required](https://img.shields.io/node/v/poker-odds.svg)](https://www.npmjs.com/package/poker-odds)\n[![Build Status](https://img.shields.io/travis/CookPete/poker-odds/master.svg)](https://travis-ci.org/CookPete/poker-odds)\n[![Test Coverage](https://img.shields.io/codecov/c/github/cookpete/poker-odds.svg)](https://codecov.io/gh/CookPete/poker-odds)\n[![Donate](https://img.shields.io/badge/donate-PayPal-blue.svg)](https://paypal.me/ckpt)\n\nA lightweight command line tool for calculating poker hand probabilities. No dependencies. No huge data files.\n\n### Installation\n\n```bash\n# yarn\nyarn global add poker-odds\n\n# npm\nnpm install -g poker-odds\n```\n\n### Usage\n\n```bash\npoker-odds AcKh KdQs   # any number of hands supported\n                       # use .. for random cards, .... for a random hand\n\n# options\n-b, --board Td7s8d     # community cards\n-i, --iterations 1000  # number of preflop simulations to run, default: 100000\n-e, --exhaustive       # run all preflop simulations\n-p, --possibilities    # show individual hand possibilities\n-n, --no-color         # disable color output\n-v, --version          # show version\n-h, --help             # show help\n```\n\nUse `--board` or `-b` to define community cards.\n\n![--board example](https://user-images.githubusercontent.com/1926029/35532782-5de9aaa0-0533-11e8-8bf0-2864f2bf0a9c.png)\n\nUse `--exhaustive` or `-e` to run all preflop simulations. Note that this will take some time.\n\n![--exhaustive example](https://user-images.githubusercontent.com/1926029/35533275-eaea7690-0534-11e8-88c9-15c993916e89.png)\n\nUse `--possibilities` or `-p` to show all possible hand outcomes. Hand possibilities are shown by default if only one hand is defined.\n\n![--possibilities example](https://user-images.githubusercontent.com/1926029/35532961-e73f5d18-0533-11e8-86f0-22c17c2d2dda.png)\n\n### API\n\nThe method used to calculate probabilities can be imported and used directly in a JS/node project:\n\n```js\nimport { calculateEquity } from 'poker-odds'\n\nconst hands = [['As', 'Kh'], ['Kd', 'Qs']]\nconst board = ['Td', '7s', '8d']\nconst iterations = 100000 // optional\nconst exhaustive = false // optional\n\ncalculateEquity(hands, board, iterations, exhaustive)\n```\n\n`calculateEquity()` returns an array of hands with the results of the simulations:\n\n```json\n[\n  {\n    \"hand\": [\n      \"Ac\",\n      \"Kh\"\n    ],\n    \"count\": 990,\n    \"wins\": 803,\n    \"ties\": 15,\n    \"handChances\": [\n      { \"name\": \"high card\", \"count\": 376 },\n      { \"name\": \"one pair\", \"count\": 479 },\n      { \"name\": \"two pair\", \"count\": 78 },\n      { \"name\": \"three of a kind\", \"count\": 13 },\n      { \"name\": \"straight\", \"count\": 44 },\n      { \"name\": \"flush\", \"count\": 0 },\n      { \"name\": \"full house\", \"count\": 0 },\n      { \"name\": \"four of a kind\", \"count\": 0 },\n      { \"name\": \"straight flush\", \"count\": 0 },\n      { \"name\": \"royal flush\", \"count\": 0 }\n    ],\n    \"favourite\": true\n  },\n  {\n    \"hand\": [\n      \"Kd\",\n      \"Qs\"\n    ],\n    \"count\": 990,\n    \"wins\": 172,\n    \"ties\": 15,\n    \"handChances\": [\n      { \"name\": \"high card\", \"count\": 351 },\n      { \"name\": \"one pair\", \"count\": 463 },\n      { \"name\": \"two pair\", \"count\": 77 },\n      { \"name\": \"three of a kind\", \"count\": 13 },\n      { \"name\": \"straight\", \"count\": 41 },\n      { \"name\": \"flush\", \"count\": 45 },\n      { \"name\": \"full house\", \"count\": 0 },\n      { \"name\": \"four of a kind\", \"count\": 0 },\n      { \"name\": \"straight flush\", \"count\": 0 },\n      { \"name\": \"royal flush\", \"count\": 0 }\n    ],\n    \"favourite\": false\n  }\n]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcookpete%2Fpoker-odds","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcookpete%2Fpoker-odds","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcookpete%2Fpoker-odds/lists"}