{"id":14133041,"url":"https://github.com/FranTheHuman/PokerHand","last_synced_at":"2025-08-04T13:33:04.081Z","repository":{"id":57803807,"uuid":"428822369","full_name":"FranTheHuman/PokerHand","owner":"FranTheHuman","description":"Functional exercise in Scala.","archived":false,"fork":false,"pushed_at":"2022-09-05T19:01:26.000Z","size":76,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-07T19:34:09.182Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FranTheHuman.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-11-16T21:41:24.000Z","updated_at":"2024-08-14T14:02:41.000Z","dependencies_parsed_at":"2023-01-17T21:02:27.373Z","dependency_job_id":null,"html_url":"https://github.com/FranTheHuman/PokerHand","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/FranTheHuman/PokerHand","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FranTheHuman%2FPokerHand","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FranTheHuman%2FPokerHand/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FranTheHuman%2FPokerHand/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FranTheHuman%2FPokerHand/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FranTheHuman","download_url":"https://codeload.github.com/FranTheHuman/PokerHand/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FranTheHuman%2FPokerHand/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268701795,"owners_count":24293003,"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","status":"online","status_checked_at":"2025-08-04T02:00:09.867Z","response_time":79,"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":[],"created_at":"2024-08-16T05:01:29.649Z","updated_at":"2025-08-04T13:33:03.491Z","avatar_url":"https://github.com/FranTheHuman.png","language":"Scala","readme":"# Poker Hand Strength Evaluator 🃏\n\nThis personal repo has the objective of containing an algorithm as functional as possible in Scala to organize different poker hands according to their strength.\n\n\n### Poker Games\n\nSupport three poker game types:\n\n* **Texas Hold'em** - input is a board of 5 cards, and multiple hands of 2 cards each.\n\n  A value of a Texas Hold'em hand is the best possible value out of all possible subsets of\n  5 cards from the 7 cards which are formed by 5 board cards and 2 hand cards.\n\n  See [Texas Hold'em rules](https://en.wikipedia.org/wiki/Texas_hold_%27em).\n\n* **Omaha Hold'em** - input is a board of 5 cards, and multiple hands of 4 cards each.\n\n  A value of an Omaha Hold'em hand is the best possible value out of all possible 5 card combinations\n  which are formed from 3 out of 5 board cards and 2 out of 4 hand cards.\n\n  See [Omaha Hold'em rules](https://en.wikipedia.org/wiki/Omaha_hold_%27em).\n\n* **Five application.models.Card Draw** - input is multiple hands of 5 cards each.\n\n  A value of a Five application.models.Card Draw hand is the value of the 5 hand cards.\n\n  See [Five application.models.Card Draw rules](https://en.wikipedia.org/wiki/Five-card_draw).\n\n### application.models.Hand Value\n\nThe hand values for 5 cards are as follows (in descending order - from strongest to weakest):\n\n* `Straight Flush` - a `Straight` (see below) which is also a `Flush` (see below)\n* `Four of a kind` - Four cards of the same rank\n* `Full House` - a combination of `Three of a kind` and a `Pair`\n* `Flush` - 5 cards of the same suit\n* `Straight` - a sequence of 5 cards of consecutive rank (note an exception - `A` can both precede `2` and follow `K`)\n* `Three of a kind` - three cards with the same rank\n* `Two pairs` - two `Pair`-s\n* `Pair` - two cards of the same rank\n* `High card` - the \"fallback\" in case no other hand value rule applies\n\nIn case of ties the ranks of the cards forming the combinations decide the highest value.\n\nIn case of further ties, the ranks of the remaining cards decide the highest value.\n\nAll suits are considered equal in strength.\n\n- When comparing `Full House`-s, the `Three of a kind` rank comparison is more important than the `Pair` rank\n  comparison, for example, `QQQ88 \u003e 999KK`, `KKK77 \u003e QQQJJ` and `KKK77 \u003e KKK66`.\n\n- When comparing `Straight`-s, the `A2345` `Straight` is the weakest one and the `TJQKA` one the strongest one,\n  for example, `23456 \u003e A2345` and `TJQKA \u003e 9TJQK`.\n\nIf any of these rules are not clear, please consult [Poker hand and categories](https://en.wikipedia.org/wiki/List_of_poker_hands#Hand-ranking_categories) and\nthe game rules of the specific poker games.\n\n### Input of Test Cases\n\nThe input is to be read as a string:\n\n```\n\u003cgame-type\u003e [\u003c5 board cards\u003e] \u003chand 1\u003e \u003chand 2\u003e \u003c...\u003e \u003chand N\u003e\n```\n\n...where:\n\n* `game-type` specifies the game type for this test case, one of:\n    * `texas-holdem` - for Texas Hold'em\n    * `omaha-holdem` - for Omaha Hold'em\n    * `five-card-draw` - for Five application.models.Card Draw\n\n* `\u003c5 board cards\u003e` is a 10 character string where each 2 characters encode a card, only used for Texas and\n  Omaha Hold' ems\n\n* `\u003chand X\u003e` is a 4, 8 or 10 character string (depending on game type) where each 2 characters encode a card\n* `\u003ccard\u003e` is a 2 character string with the first character representing the rank\n  (one of `A`, `K`, `Q`, `J`, `T`, `9`, `8`, `7`, `6`, `5`, `4`, `3`, `2`) and the second character representing\n  the suit (one of `h`, `d`, `c`, `s`). Jokers are not used.\n\n### Output of Solutions\n\nThe output should be returned as a string:\n\n```\n\u003chand block 1\u003e \u003chand block 2\u003e \u003c...\u003e \u003chand block n\u003e\n```\n... where:\n\n* `\u003chand block 1\u003e` is the hand block with the weakest value\n* `\u003chand block 2\u003e` is the hand block with the second weakest value\n* ... and so forth.\n* `\u003chand block n\u003e` is the hand block with the strongest value\n\nEach hand block consists of one or multiple hands (each represented by 4, 8 or 10 character string, depending\non game type, with 2 characters to encode a card) with equal hand value.\n\nIn case there are multiple hands with the same value on the same board they should be ordered alphabetically\nand separated by `=` signs.\n\nThe order of the cards in each hand should remain the same as in the input, e.g., don't reorder `2h3s` into\n`3s2h`.\n\n#### Examples\n\nExample input:\n```\ntexas-holdem 4cKs4h8s7s Ad4s Ac4d As9s KhKd 5d6d\ntexas-holdem 2h3h4h5d8d KdKs 9hJh\nomaha-holdem 3d3s4d6hJc Js2dKd8c KsAsTcTs Jh2h3c9c Qc8dAd6c 7dQsAc5d\nfive-card-draw 7h4s4h8c9h Tc5h6dAc5c Kd9sAs3cQs Ah9d6s2cKh 4c8h2h6c9c\n```\n\nExample output:\n```\nAc4d=Ad4s 5d6d As9s KhKd\nKdKs 9hJh\nQc8dAd6c KsAsTcTs Js2dKd8c 7dQsAc5d Jh2h3c9c\n4c8h2h6c9c Ah9d6s2cKh Kd9sAs3cQs 7h4s4h8c9h Tc5h6dAc5c\n```\n\n### How to run in a console\n\n    sbt 'run command-line'\n\n### How to run it from a file\n\n    sbt 'run file'\n\n### How to run it from REST API\n\n    sbt 'run rest'\n\n### How to run it from GRAPHQL API\n\n    Not Implemented\n\n### How to test\n\n    Not Implemented\n\n### See Previous Games\n\n    You can find previous sucess games results and types in the database","funding_links":[],"categories":["Scala"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFranTheHuman%2FPokerHand","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFranTheHuman%2FPokerHand","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFranTheHuman%2FPokerHand/lists"}