{"id":15504635,"url":"https://github.com/alanbsmith/quickdraw","last_synced_at":"2025-03-28T18:43:42.212Z","repository":{"id":78448068,"uuid":"45797262","full_name":"alanbsmith/quickdraw","owner":"alanbsmith","description":"A poker hand evaluator written in Ruby!","archived":false,"fork":false,"pushed_at":"2015-11-12T19:44:50.000Z","size":0,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-02T19:28:57.673Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/alanbsmith.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":"2015-11-08T20:19:55.000Z","updated_at":"2015-11-13T20:59:27.000Z","dependencies_parsed_at":"2023-03-10T15:45:37.211Z","dependency_job_id":null,"html_url":"https://github.com/alanbsmith/quickdraw","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alanbsmith%2Fquickdraw","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alanbsmith%2Fquickdraw/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alanbsmith%2Fquickdraw/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alanbsmith%2Fquickdraw/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alanbsmith","download_url":"https://codeload.github.com/alanbsmith/quickdraw/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246083017,"owners_count":20720895,"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":[],"created_at":"2024-10-02T09:19:21.328Z","updated_at":"2025-03-28T18:43:42.194Z","avatar_url":"https://github.com/alanbsmith.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# QUICKDRAW\n\n### OVERVIEW\nQuickDraw is a poker hand evaluator built in Ruby! It's designed to use a special shorthand to make checking cards quick and easy.\n\n**EXAMPLE SHORTHAND**\n\nGiven this hand of cards:\n\n_King of hearts, Jack of spades, 9 of clubs, 10 of hearts, 3 of diamonds_\n\nThe correlating shorthand:\n\n_kh js 9c 10h 3d_\n\n### DIFFERENT TYPES OF POKER HANDS\nBelow are the various types of poker hands (ranked in order)\n\n|HAND TYPE| DESCRIPTION | EXAMPLE |\n|---------|-------------|---------|\n|ROYAL FLUSH|        hightest hand possible, all same suit|  10 of hearts, Jack of hearts, Queen of hearts, King of hearts, Ace of hearts|\n|STRAIGHT FLUSH|     all same suit in sequential order|      5 of clubs, 6 of clubs, 7 of clubs, 8 of clubs, 9 of clubs|\n|FOUR OF A KIND|     Same 4 faces|                           Ace of hearts, Ace of clubs, Ace of diamonds, Ace of spades, 8 of hearts|\n|FULL HOUSE|         3 of a kind and 2 of a kind|            King of hearts, King of clubs, King of spades, 9 of hearts, 9 of clubs|\n|FLUSH|              all same suit|                          Queen of clubs, 8 of clubs, 6 of clubs, 4 of clubs, 3 of clubs|\n|STRAIGHT|           in sequential order|                    2 of diamonds, 3 of clubs, 4 of spades, 5 of diamonds, 6 of clubs|\n|THREE OF A KIND|    Same 3 faces|                           Jack of clubs, Jack of hearts, Jack of diamonds, 5 of clubs, 8 of diamonds|\n|TWO PAIR|           2 sets of 2 of a kind|                  8 of diamonds, 8 of clubs, 4 of diamonds, 6 of spades, 6 of clubs|\n|ONE PAIR|           2 of a kind|                            Ace of hearts, Ace of clubs, 3 of hearts, 8 of spades, 2 of diamonds|\n|HIGH CARD|          single high card|                       King of hearts, Jack of spades, 9 of clubs, 6 of hearts, 3 of diamonds|\n\n### UP \u0026 RUNNING\nclone the repo and run `bundle install`\n\n### USING THE CLI\nThe CLI is designed to explain and faciliate the use of QuickDraw. To get it up and running, simply run `ruby quickdraw.rb` from the root of this directory. In it you'll find explanations of various hands, and you can try out multiple hands to see the results.\n\n### USING THE API\nThe API is a simple Sinatra controller with two endpoints: `api/v1/cards` and `api/v1/deal`. The `cards` endpoint takes params (e.g: 'ad ac ah as 4c') and returns a JSON object if the query is valid. If the request is not valid it will return 'Invalid Query'.\n\nThe `deal` endpoint returns a randomly generated hand and the value of the hand. This endpoint is used by the client-side React app.\n\nThis API is served by Rackup, so it runs on port: 9292. To fire up the API simply run `rackup`. This API also allows cross origin requests, so a client application could make AJAX requests to it.\n\n### USING THE CLIENT APP\nThe client-side application for QuickDraw is written in React! It's main function is to make AJAX requests to the QuickDraw API, display random hands and the value.\n\nTo use the client app:\n- hop in the `quickdraw-client` directory\n- run `npm install`\n- _be sure to run the separateSinatra API as well (see USING THE API above)_\n- open your browser to 'localhost:8080'\n- clicking 'DEAL ME' will generate a hand of five cards.\n\n**EXAMPLE REQUEST TO THE 'CARDS' ENDPOINT:**\n`localhost:9292/api/v1/cards?ah as ac ad 3s`\n\n**EXAMPLE RESPONSE:**\n```\n{\n  cards: [\n    \"Ace of Hearts\",\n    \"Ace of Spades\",\n    \"Ace of Clubs\",\n    \"Ace of Diamonds\",\n    \"3 of Spades\"\n  ],\n  value: \"Four of a Kind (Aces)\"\n}\n```\n\n### TESTING\nThe bulk of the tests tests are for `hand.rb`, where the majority of the logic lives. You'll probably notice that there are no 'sad path' tests for `hand.rb`. This is because `Hand` is just an internal receiving service, and therefore is only concerned with proper input. All validations are handled by the Validator module which is used by the sending services (CLI and the API). The data is validated before `Hand` ever gets to it. This allows the CLI and API to be in charge of interacting with input and allows the internal service to be concerned with giving back the proper data. \n\nThe Validator tests are focused specifically on the module methods. The Validator is used by both the API and the CLI to ensure proper formatting before hitting the Hand service.\n\n**RUNNING THE TESTS**\n\nYou can run `rake` from the root of this directory to run all the tests.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falanbsmith%2Fquickdraw","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falanbsmith%2Fquickdraw","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falanbsmith%2Fquickdraw/lists"}