{"id":16104994,"url":"https://github.com/dbc2201/blackjack","last_synced_at":"2025-04-06T02:29:59.074Z","repository":{"id":133011456,"uuid":"461849940","full_name":"dbc2201/blackjack","owner":"dbc2201","description":null,"archived":false,"fork":false,"pushed_at":"2022-02-21T12:23:51.000Z","size":115,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-12T08:39:46.744Z","etag":null,"topics":["exercism-solutions","java"],"latest_commit_sha":null,"homepage":"https://exercism.org/tracks/java/exercises/blackjack","language":"HTML","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/dbc2201.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-21T12:23:47.000Z","updated_at":"2022-02-21T12:26:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"a7346b2a-8318-462d-bc43-1f03bbd7b6f2","html_url":"https://github.com/dbc2201/blackjack","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/dbc2201%2Fblackjack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbc2201%2Fblackjack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbc2201%2Fblackjack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbc2201%2Fblackjack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dbc2201","download_url":"https://codeload.github.com/dbc2201/blackjack/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247425670,"owners_count":20936999,"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":["exercism-solutions","java"],"created_at":"2024-10-09T19:07:41.455Z","updated_at":"2025-04-06T02:29:59.068Z","avatar_url":"https://github.com/dbc2201.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Play Your Cards!\n\nWelcome to Play Your Cards! on Exercism's Java Track. If you need help running the tests or submitting your code, check\nout `HELP.md`. If you get stuck on the exercise, check out `HINTS.md`, but try and solve it without using those first :)\n\n## Introduction\n\n## Logical Operators\n\nJava supports the three logical operators `\u0026\u0026` (AND), `||` (OR), and `!` (NOT).\n\n## If statement\n\nThe underlying type of any conditional operation is the `boolean` type, which can have the value of `true` or `false`.\nConditionals are often used as flow control mechanisms to check for various conditions. For checking a particular case\nan `if` statement can be used, which executes its code if the underlying condition is `true` like this:\n\n```java\nint val;\n\n        if(val==9){\n        // conditional code\n        }\n```\n\nIn scenarios involving more than one case many `if` statements can be chained together using the `else if` and `else`\nstatements.\n\n```java\nif(val==10){\n        // conditional code\n        }else if(val==17){\n        // conditional code\n        }else{\n        // executes when val is different from 10 and 17\n        }\n```\n\n## Switch statement\n\nJava also provides a `switch` statement for scenarios with multiple options.\n\n```java\nint val;\n\n// switch statement on variable content\n        switch(val){\n        case 1:\n        // conditional code\n        break;\n        case 2:case 3:case 4:\n        // conditional code\n        break;\ndefault:\n        // if all cases fail\n        break;\n        }\n```\n\n## Instructions\n\nIn this exercise we will simulate the first turn of a [Blackjack](https://en.wikipedia.org/wiki/Blackjack) game.\n\nYou will receive two cards and will be able to see the face up card of the dealer. All cards are represented using a\nstring such as \"ace\", \"king\", \"three\", \"two\", etc. The values of each card are:\n\n| card  | value | card  | value |\n| :---: | :---: | :---: | :---: |\n|  ace  |  11   | eight |   8   |\n|  two  |   2   | nine  |   9   |\n| three |   3   |  ten  |  10   |\n| four  |   4   | jack  |  10   |\n| five  |   5   | queen |  10   |\n|  six  |   6   | king  |  10   |\n| seven |   7   | other |   0   |\n\n**Note**: Commonly, aces can take the value of 1 or 11 but for simplicity we will assume that they can only take the\nvalue of 11.\n\nDepending on your two cards and the card of the dealer, there is a strategy for the first turn of the game, in which you\nhave the following options:\n\n    - Stand (S)\n    - Hit (H)\n    - Split (P)\n    - Automatically win (W)\n\nAlthough not optimal yet, you will follow the strategy your friend Alex has been developing, which is as follows:\n\nCategory: Large Hand\n\n- If you have a pair of aces you must always split them.\n- If you have a Blackjack (two cards that sum up to a value of 21), and the dealer does not have an ace, a figure or a\n  ten then you automatically win. If the dealer does have any of those cards then you'll have to stand and wait for the\n  reveal of the other card.\n\nCategory: Small Hand\n\n- If your cards sum up to 17 or higher you should always stand.\n- If your cards sum up to 11 or lower you should always hit.\n- If your cards sum up to a value within the range [12, 16] you should always stand unless the dealer has a 7 or higher,\n  in which case you should always hit.\n\nThe overall logic has already been implemented. You have four tasks:\n\n## 1. Calculate the score of any given card.\n\nImplement a function to calculate the numerical value of a card given its name using conditionals.\n\n```java\nparseCard(\"ace\")\n// returns 11\n```\n\n## 2. Determine if two cards make up a Blackjack.\n\nImplement a function that returns `true` if two cards form a Blackjack, `false` otherwise.\n\n```java\nisBlackjack(\"queen\",\"ace\")\n// returns true\n```\n\n## 3. Implement the decision logic for hand scores larger than 20 points.\n\nImplement a function that returns the string representation of a decision given your cards. This function is only called\nif the `handScore` is larger than 20. It will receive 2 arguments: `isBlackJack` and `dealerScore`. It should implement\nthe bulletpoints in the category \"Large Hand\" above.\n\n```java\nisBlackJack=true\n        dealerScore=7\n        largeHand(isBlackJack,dealerScore)\n// returns \"W\"\n```\n\n## 4. Implement the decision logic for hand scores with less than 21 points.\n\nImplement a function that returns the string representation of a decision given your cards. This function is only called\nif the `handScore` is less than 21. It will receive 2 arguments: `handScore` and `dealerScore`. It should implement the\nbulletpoints in the category \"Small Hand\" above.\n\n```java\nhandScore=15\n        dealerScore=12\n        SmallHand(handScore,dealerScore)\n// returns \"H\"\n```\n\n## Source\n\n### Created by\n\n- @TalesDias","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbc2201%2Fblackjack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdbc2201%2Fblackjack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbc2201%2Fblackjack/lists"}