{"id":50192413,"url":"https://github.com/kedoska/engine-blackjack","last_synced_at":"2026-05-25T14:14:54.357Z","repository":{"id":57225325,"uuid":"70997259","full_name":"kedoska/engine-blackjack","owner":"kedoska","description":"Javascript library to make blackjack engines","archived":false,"fork":false,"pushed_at":"2020-06-05T19:14:26.000Z","size":431,"stargazers_count":32,"open_issues_count":5,"forks_count":27,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-04-03T16:37:26.926Z","etag":null,"topics":["blackjack","games","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kedoska.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-15T15:47:17.000Z","updated_at":"2025-08-01T04:30:32.000Z","dependencies_parsed_at":"2022-08-24T11:00:22.787Z","dependency_job_id":null,"html_url":"https://github.com/kedoska/engine-blackjack","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/kedoska/engine-blackjack","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kedoska%2Fengine-blackjack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kedoska%2Fengine-blackjack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kedoska%2Fengine-blackjack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kedoska%2Fengine-blackjack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kedoska","download_url":"https://codeload.github.com/kedoska/engine-blackjack/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kedoska%2Fengine-blackjack/sbom","scorecard":{"id":553393,"data":{"date":"2025-08-11","repo":{"name":"github.com/kedoska/engine-blackjack","commit":"046c62d8cc0f903a85f2397636b5349b84472055"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 1/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: GNU General Public License v2.0: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 23 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"133 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-whgm-jr23-g3j9","Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-832h-xg76-4gv6","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx","Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-9vvw-cc9w-f27h","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-hr2v-3952-633q","Warn: Project is vulnerable to: GHSA-h6ch-v84p-w6p9","Warn: Project is vulnerable to: GHSA-3wcq-x3mq-6r9p","Warn: Project is vulnerable to: GHSA-vh7m-p724-62c2","Warn: Project is vulnerable to: GHSA-r9p9-mrjm-926w","Warn: Project is vulnerable to: GHSA-434g-2637-qmqr","Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m","Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw","Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p","Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747","Warn: Project is vulnerable to: GHSA-vjh7-7g9h-fjfh","Warn: Project is vulnerable to: GHSA-4gmj-3p3h-gm8h","Warn: Project is vulnerable to: GHSA-6h5x-7c5m-7cr7","Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc","Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx","Warn: Project is vulnerable to: GHSA-qrmc-fj45-qfc2","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-mpcf-4gmh-23w8","Warn: Project is vulnerable to: GHSA-9qj9-36jm-prpv","Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3","Warn: Project is vulnerable to: MAL-2023-462","Warn: Project is vulnerable to: GHSA-xf7w-r453-m56c","Warn: Project is vulnerable to: GHSA-q42p-pg8m-cqh6","Warn: Project is vulnerable to: GHSA-w457-6q6x-cgp9","Warn: Project is vulnerable to: GHSA-62gr-4qp9-h98f","Warn: Project is vulnerable to: GHSA-f52g-6jhx-586p","Warn: Project is vulnerable to: GHSA-2cf5-4w76-r9qv","Warn: Project is vulnerable to: GHSA-3cqr-58rm-57f8","Warn: Project is vulnerable to: GHSA-g9r4-xpmj-mj65","Warn: Project is vulnerable to: GHSA-q2c6-c6pm-g3gh","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-44pw-h2cw-w3vq","Warn: Project is vulnerable to: GHSA-jp4x-w63m-7wgm","Warn: Project is vulnerable to: GHSA-c429-5p7v-vgjp","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-6x33-pw7p-hmpq","Warn: Project is vulnerable to: GHSA-c7qv-q95q-8v27","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22","Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp","Warn: Project is vulnerable to: GHSA-4hpf-3wq7-5rpr","Warn: Project is vulnerable to: GHSA-f522-ffg8-j8r6","Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546","Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-282f-qqgm-c34q","Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq","Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488","Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g","Warn: Project is vulnerable to: GHSA-fvqr-27wr-82fm","Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574","Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-4xcv-9jjx-gfj3","Warn: Project is vulnerable to: GHSA-f9cm-qmx5-m98h","Warn: Project is vulnerable to: GHSA-7wpw-2hjm-89gp","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-wrvr-8mpx-r7pp","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-w9mr-4mfr-499f","Warn: Project is vulnerable to: GHSA-92xj-mqp7-vmcj","Warn: Project is vulnerable to: GHSA-wxgw-qj99-44c2","Warn: Project is vulnerable to: GHSA-5rrq-pxf6-6jx5","Warn: Project is vulnerable to: GHSA-8fr3-hfg3-gpgp","Warn: Project is vulnerable to: GHSA-gf8q-jrpm-jvxq","Warn: Project is vulnerable to: GHSA-2r2c-g63r-vccr","Warn: Project is vulnerable to: GHSA-cfm4-qjh2-4765","Warn: Project is vulnerable to: GHSA-x4jg-mjrx-434g","Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p","Warn: Project is vulnerable to: GHSA-6394-6h9h-cfjg","Warn: Project is vulnerable to: GHSA-76c9-3jph-rj3q","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w","Warn: Project is vulnerable to: GHSA-v62p-rq8g-8h59","Warn: Project is vulnerable to: GHSA-gqgv-6jq5-jjj9","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-hxcm-v35h-mg2x","Warn: Project is vulnerable to: GHSA-6g33-f262-xjp4","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p","Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6","Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj","Warn: Project is vulnerable to: GHSA-c9g6-9335-x697","Warn: Project is vulnerable to: GHSA-2m39-62fm-q8r3","Warn: Project is vulnerable to: GHSA-mf6x-7mm4-x2g7","Warn: Project is vulnerable to: GHSA-j44m-qm6p-hp7m","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-g7q5-pjjr-gqvp","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v","Warn: Project is vulnerable to: GHSA-xc7v-wxcw-j472","Warn: Project is vulnerable to: GHSA-pv4c-p2j5-38j4","Warn: Project is vulnerable to: GHSA-46c4-8wrp-j99v","Warn: Project is vulnerable to: GHSA-9m6j-fcg5-2442","Warn: Project is vulnerable to: GHSA-hh27-ffr2-f2jc","Warn: Project is vulnerable to: GHSA-rqff-837h-mm52","Warn: Project is vulnerable to: GHSA-8v38-pw62-9cw2","Warn: Project is vulnerable to: GHSA-hgjh-723h-mx2j","Warn: Project is vulnerable to: GHSA-jf5r-8hm2-f872","Warn: Project is vulnerable to: GHSA-wr3j-pwj9-hqq6","Warn: Project is vulnerable to: GHSA-cf66-xwfp-gvc4","Warn: Project is vulnerable to: GHSA-4v9v-hfq4-rm2v","Warn: Project is vulnerable to: GHSA-9jgg-88mc-972h","Warn: Project is vulnerable to: GHSA-g78m-2chm-r7qv","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-20T11:37:08.738Z","repository_id":57225325,"created_at":"2025-08-20T11:37:08.738Z","updated_at":"2025-08-20T11:37:08.738Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33478335,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-25T06:32:55.349Z","status":"ssl_error","status_checked_at":"2026-05-25T06:32:35.322Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["blackjack","games","nodejs"],"created_at":"2026-05-25T14:14:53.424Z","updated_at":"2026-05-25T14:14:54.350Z","avatar_url":"https://github.com/kedoska.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://cloud.githubusercontent.com/assets/11739105/19564224/62fd8836-96a8-11e6-97ea-6d31464eb316.png\" alt=\"engine-blackjack\" style=\"max-width:100%;\"\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  engine-blackjack - implement blackjack game into your software.\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://travis-ci.org/kedoska/engine-blackjack\"\u003e\u003cimg src=\"https://travis-ci.org/kedoska/engine-blackjack.svg\" alt=\"build:\"\u003e\u003c/a\u003e\n\u003ca href=\"https://david-dm.org/kedoska/engine-blackjack/\"\u003e\u003cimg src=\"https://david-dm.org/kedoska/engine-blackjack/status.svg\" alt=\"Dependency Status\"\u003e\u003c/a\u003e\n\u003ca href=\"https://david-dm.org/kedoska/engine-blackjack/?type=dev\"\u003e\u003cimg src=\"https://david-dm.org/kedoska/engine-blackjack/dev-status.svg\" alt=\"devDependency Status\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n___\n\n## Available game parameters\n\nThere are many possible configuration. We are implementing _Standard_ and _Custom_ options \nso that you can easily _combine flags_ to create games according with your skill/needs.\n\n### Standard variations\n\n * number of `decks`, default is `1`\n * `standOnSoft17`, turn On/Off the \"Soft 17\" rule, default `true`\n * `double`, ability to double after deal, default `any`\n    * `none` not allowed\n    * `any` any allowed\n    * `9or10`\n    * `9or10or11`\n    * `9thru15`\n * `split`, On/Off the possibility to split after deal, default `true`\n * `doubleAfterSplit`, On/Off the possibility to double after split (_split_ and _double_ must be \"on\"), default `true`\n * `surrender`, on/off the ability to surrender after deal, default `true`\n * `insurance`, on/off the ability of ensuring a hand, default `true`\n\n### Custom variations\n\nThere are many variations of this game and I really do not know them all, but if you ask me I will add them. \nHere a list of direct (and maybe exotic) requests:\n\n * `showdownAfterAceSplit`, after the _deal_ and if player receives 2 aces and a _split_ is called, a card is dealt on each side and _showdown phase_ is initialized (the game ends) default `true` but it depends on `split`.\n\n## Install\n\nIf you are using [npm](https://www.npmjs.com/), to get the last version:\n\n * `yarn add engine-blackjack`\n * `npm install engine-blackjack`\n\nI'm currently publishing the master branch into NPM until I get the first _tag_.\nIdeally, only _tagged commits_ will be uploaded as NPM after that moment.\n\nNOTE: Master branch is under development. Be sure to \"ONLY\" use tagged version for your production.\n\n## Quick Start\n\nOnce obtained the library just _require_ `Game` and `actions`. \n\n```\nconst blackjack = require('engine-blackjack')\nconst actions = blackjack.actions\nconst Game = blackjack.Game\n```\n\nAt this point you can initialize a _new game_ by calling the `Game constructor`.\n\n### Creating a new game\n\n```\nconst game = new Game()\n```\n\nIn this cases, no state is passed to the constructor: \n\n 1. the _default_ state is loaded into _game_\n 2. _game_ is ready to _`dispatch` actions_ to alter the state\n\n### Getting current state\n\nAt any moment we can require the current state of the _game_ by calling the `getState()`.\n\n```\nconsole.dir(game.getState())\n```\n\nThe content of the state and its _schema_ depends on the _stage_ of the game. In this case\nwe initialized the game without any precedent state, so we will receive something like this:\n\n```\n{\n  hits: 0,\n  stage: 'ready',\n  deck: [\n    { text: '9', suite: 'clubs', value: 9 },\n    { text: '7', suite: 'clubs', value: 7 },\n    ...\n    ...\n  ],\n  handInfo: { left: {}, right: {} },\n  history: []\n}\n```\n\nFor the moment the only thing we should note is that the _field_ `stage` tells us \"game is ready\".\n\n### Dispatching actions\n\nThe only way *to mutate the state of the game* is to dispatch actions. Some actions are required by the \"user\",\nsome other actions are dispatched by the engine to \"complete\" the game.\n\nNOTE: In a real game, players and dealer are allowed to \"do actions\". The engine will \"impersonate the dealer\" at some point, depending on the _last action_ and the _state_.\n\n```\n// stage is \"ready\"\nconsole.log(game.getState().stage)\n\n// call an action to mutate the state\ngame.dispatch(actions.deal())\n\n// stage has changed\nconsole.log(game.getState().stage)\n```\n\n## Project Structure\n\n### Guidelines that I follow\n\nInspired by projects done by people I consider smart, like Flux or Redux, \nand motivated by the desire to introduce the functional paradigm in my work day:\n\n 1. platform agnostic (if you can run Node, you are ok. Node can run everywhere)\n 2. zero-dependencies (only dev-dependencies)\n 3. TDD, break every single game action to be testable\n 4. Implement everything that makes sense (and described in [WikipediA](https://en.wikipedia.org/wiki/Blackjack))\n \nEverything you need to hack is of course inside `/src` or `/test` and \n`npm test` does what you expect (plus a lot of console.log for the moment)\n\n### Actions\n\nsee the `/src/actions.js`\n\nEngine exposes _actions_, once invoked, the state of the game is changed.\nThe following list represent the _actions_ that can be _dispatched_ by from the public API.\n\n * restore\n * deal\n * insurance\n * double\n * split\n * hit\n * stand\n\nAnd, those are _actions_ that are internally called in determinate _stages_ by the engine itself.\n\n * showdown\n * dealerHit\n * invalid\n \n### Stages\n\nSee the `/src/game.js`\n\nThe stage represent a moment in the game. The stage is directly related with the action allowed in that particular moment.\n\nCurrent available stages are:\n\n * ready\n * player-turn-left\n * player-turn-right (optional)\n * showdown\n * dealer-turn\n * done\n\n### Logic\n\nThe game logic is implemented into `/src/engine.js`. There some more methods, strictly related to the _tests_ and for the moment are not tested (_who test the test_ is not yet solved).\nThere is a specific design limitation currently in the code. Currently it support only 2 position, user can \"split\" but it is not possible at the moment to create more complex variants of the game.\n\nNOTE: If you are interested in the random components, check out the `shuffle()` function.\n\n## Test\n\nRun tests by calling `yarn test ` or `npm test`\n\nYou can also write specific test cases using this syntax. For more details have a look at [game.spec.js](https://github.com/kedoska/engine-blackjack/blob/master/test/game.spec.js) \n\n```\n{\n  cards: '♠10 ♦1 ♥5 ♣6 ♠11 ♦10',\n  actions: ['restore', 'deal', 'split', 'standR'],\n  stage: 'done',\n  finalWin: 0\n}\n```\n\n[Jest](https://facebook.github.io/jest/) will care about the following tasks:\n - create a new game\n - initialize it by injecting `♠10 ♦1 ♥5 ♣6 ♠11 ♦10` at the and of the _deck_\n - run the desired `restore`, `deal`, `split` and finally `standR` (stand on right) \n - return the current state\n - compare if `stage` is 'done' at the end\n\nIf you specify the `finalWin` the test will compare the final winning.\n\n## Stats\n\nProbabilities are not my favourite things... but apparently they are important for someone.\nGot some information here:\n\n * [In blackjack, what is the probability of a blackjack?](https://wizardofodds.com/ask-the-wizard/blackjack/probability/)\n * [Dealer's Bust-Out Rate](http://www.blackjackage.com/bust-out-rate.php)\n\n## Random\n\nPlease consider that for stress test this is the used random fn. It overrides the getRandom provided by [52-deck](https://github.com/kedoska/52-deck)\n\n```javascript\nconst deck = require('52-deck')\ndeck.getRandom = (min, max) =\u003e {\n  let number\n  const range = max - min + 1\n  do\n  {\n    const buffer = crypto.randomBytes(4)\n    number = buffer.readUInt8(0)\n  }\n  while (number \u003e= Number.MAX_VALUE - (Number.MAX_VALUE % range))\n  number %= range\n  return number + min\n}\n```\n\nThe original function (provided by 52-deck) is `const getRandom = (v: number) =\u003e Math.floor(Math.random() * v)`.\nI just wanted to be fancy importing and implementing something approved by a well known game laboratory _(No more details here)_.\n\n## Side Bets\n\nSide bets are part of the \"multi-game strategy\". They are returned to the client as \"available bets\" and they can be sets in the `deal()` _payload_.\nEngine will calculate the side bet result during the `deal()`\n\n# License\n\nengine-blackjack\nCopyright (C) 2016 Marco Casula\n\nThis program is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation; version 2 of the License.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License along\nwith this program; if not, write to the Free Software Foundation, Inc.,\n51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n\n# Credits\n\nThanks @webpty for logos\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkedoska%2Fengine-blackjack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkedoska%2Fengine-blackjack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkedoska%2Fengine-blackjack/lists"}