{"id":49107445,"url":"https://github.com/ecavan/poker_hand_probabilities","last_synced_at":"2026-04-21T02:17:58.963Z","repository":{"id":199841903,"uuid":"595891492","full_name":"ecavan/poker_hand_probabilities","owner":"ecavan","description":"Python Tools for Poker Players","archived":false,"fork":false,"pushed_at":"2023-04-20T02:37:07.000Z","size":237,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-10-12T21:10:48.433Z","etag":null,"topics":["poker","statistics","texas-holdem"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ecavan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-02-01T02:33:30.000Z","updated_at":"2023-10-12T21:10:51.299Z","dependencies_parsed_at":null,"dependency_job_id":"eea5cecf-b390-4005-bc3d-d8e5ede9b22b","html_url":"https://github.com/ecavan/poker_hand_probabilities","commit_stats":null,"previous_names":["ecavan/poker_hand_probabilities"],"tags_count":null,"template":null,"template_full_name":null,"purl":"pkg:github/ecavan/poker_hand_probabilities","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecavan%2Fpoker_hand_probabilities","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecavan%2Fpoker_hand_probabilities/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecavan%2Fpoker_hand_probabilities/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecavan%2Fpoker_hand_probabilities/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ecavan","download_url":"https://codeload.github.com/ecavan/poker_hand_probabilities/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecavan%2Fpoker_hand_probabilities/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32073521,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T01:35:38.224Z","status":"online","status_checked_at":"2026-04-21T02:00:06.111Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["poker","statistics","texas-holdem"],"created_at":"2026-04-21T02:17:55.114Z","updated_at":"2026-04-21T02:17:58.956Z","avatar_url":"https://github.com/ecavan.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Python Poker Tools\n\n[![Screen-Shot-2023-02-03-at-4-19-47-PM.png -thumbnail](https://i.postimg.cc/qBCxmFxx/Screen-Shot-2023-02-03-at-4-19-47-PM.png)](https://postimg.cc/0rPSjc3z)\n\u003cdiv align=\"center\"\u003eTop Poker Hands (https://www.888poker.com/magazine/how-to-play-poker/hands)\u003c/div\u003e\n\u003cbr /\u003e\n  \n  \u003e “Fold and live to fold again.” ~ Stu Ungar\n\n\u003cbr /\u003e\n\nNow a shiny app with more functionality: https://ecavs.shinyapps.io/poker-app/\n\n# Table of Contents\n1. [Installation](#Installation)\n2. [Get Hand Odds](#Get-Hand-Odds)\n3. [Get Best Hand given Face Cards](#Get-Best-Hand-given-Face-Cards)\n4. [Simulate Hand](#Simulate-Hand)\n\n## Installation\n\nTo install:\n```\npip install pokerprobs\n```\n(or download the repo, cd into it and run pip install -e .; if not try the same with pip3)\n\nThe cards are input and output as, for example, 12h,9d,3c; where h,d,c,s represent the suits hearts, diamonds, clubs and spades and 11,12,13,14 represent the jack, queen, king and ace respectively. There are three modules:\n\n## Get Hand Odds\n\n```\n\u003e\u003e\u003e import pokerprobs \n\u003e\u003e\u003e pokerprobs.get_hand_odds(num_players, num_sims)\n```\nThis function asks you for a starting hand (2 cards) and outputs the probability of each 5-card result using monte carlo simulations. The default number of sims is 10k (you can run the function as  pokerprobs.get_hand_odds(num_players)); but in my experience you may want to set num_sims to be between 100k-300k for the best result for the rarer hand combinations. For example, here I've input the Doyle Brunson special:\n```\nFirst Card: 10s\nSecond Card: 2c\n\n              Hand  Probability\n0   Four of a Kind         0.13\n1   Straight Flush         0.13\n2            Flush         1.84\n3       Full House         2.01\n4         Straight         3.25\n5  Three of a Kind         4.28\n6        High Card        20.26\n7         Two Pair        22.00\n8             Pair        46.10\n```\n\nAs an aside, this example compares the returned probabilities when playing with pocket kings\n\n```\n\u003e\u003e\u003e pokerprobs.get_hand_odds(6)\nFirst Card: 13c\nSecond Card: 13d\n\n              Hand  Probability\n0   Straight Flush         0.04\n1   Four of a Kind         0.76\n2         Straight         1.03\n3            Flush         1.83\n4       Full House         8.30\n5  Three of a Kind        11.93\n6             Pair        36.17\n7         Two Pair        39.94\n\n\u003e\u003e\u003e pokerprobs.get_hand_odds(6,500000)\nFirst Card: 13c\nSecond Card: 13d\n\n              Hand  Probability\n0      Royal Flush       0.0008\n1   Straight Flush       0.0370\n2   Four of a Kind       0.8388\n3         Straight       1.2202\n4            Flush       1.9514\n5       Full House       8.3452\n6  Three of a Kind      11.9694\n7             Pair      36.0032\n8         Two Pair      39.6340\n```\n\nThere is an obvious trade off in the time it takes for the function to execute.\n\n## Get Best Hand given Face Cards\n\n```\n\u003e\u003e\u003e import pokerprobs \n\u003e\u003e\u003e pokerprobs.get_nuts()\n```\nexample output:\n```\nBurn Cards\n5s 11c 14h\n\nCommunity Cards\n14s 14c 2h 9h 13h\n\n  Best Hand        Hand Name  Hand Value  Frequency %\n1   14h 14d   Four of a Kind           8     0.092507\n2   13s 14h       Full House           7     2.497687\n3    6h 14h            Flush           6     4.162812\n4   10s 14h  Three of a Kind           4     5.827937\n5    9c 13s         Two Pair           3    37.465310\n6   10s 11d             Pair           2    49.953747\n```\nThis function returns a random set of community cards, and iterates through all combinations of starting hands to give you the best 5-card results and the probability that they will occur. If you would like to specify your own community cards:\n \n```\n\u003e\u003e\u003e import pokerprobs\n\u003e\u003e\u003e pokerprobs.get_nuts(False)\nCommunity Cards (Spaced): 12s 10h 5d 6c 5s\n  Best Hand        Hand Name  Hand Value  Frequency %\n1     5h 5c   Four of a Kind           8     0.092507\n2   12h 12d       Full House           7     2.497687\n3     2h 5h  Three of a Kind           4     6.660500\n4   14h 14d         Two Pair           3    37.465310\n5     2h 3h             Pair           2    53.283996\n```\nAs I get more time I'd like to expand the functionality to the get_nuts (just as a disclaimer record, the \"Nuts\" is the best hand in poker) and get_hand_odds functions to allow for simulations after flop, turn, river.\n\n## Simulate Hand\n\n```\n\u003e\u003e\u003e import pokerprobs \n\u003e\u003e\u003e pokerprobs.print_game(num_players)\n```\n\nThis outputs a mock hand against specified number of players. It doesn't encoporate betting, but you can think about what you would have done given the flop, turn, ect. The output for a 6 player hand I ran for ex:\n\n```\n8c 11c\n\nCommunity Cards\n10s 12d 14c 7h 6d\n\nOpponent Hands:\n8c 3c | 11c 5s | 12h 5c | 9d 3s | 2c 7c | \n\nHand Results\nYou had High Card vs Top Opponent Pair\n```\n\nFeel free to DM on twitter [@cavan_elijah](https://twitter.com/cavan_elijah) for comments/requests. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecavan%2Fpoker_hand_probabilities","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fecavan%2Fpoker_hand_probabilities","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecavan%2Fpoker_hand_probabilities/lists"}