{"_id":"@alexjamesmalcolm/poker-odds-machine","_rev":"6-af759038972ff198a861fb4a966a11e0","name":"@alexjamesmalcolm/poker-odds-machine","dist-tags":{"latest":"1.1.1"},"versions":{"1.0.3":{"name":"@alexjamesmalcolm/poker-odds-machine","version":"1.0.3","description":"Poker odds machine (calculator)","main":"dist/index.js","types":"index.ts","private":false,"scripts":{"test":"node dist/test/index.js","build":"rm -rf dist && tsc","watch":"tsc -w","prepublishOnly":"npm run build"},"author":{"name":"Emile Indik"},"repository":{"type":"git","url":"git+https://github.com/emileindik/poker-odds-machine.git"},"keywords":["poker","odds","calculator"],"license":"MIT","devDependencies":{"@types/node":"^14.17.33","typescript":"^4.4.4"},"gitHead":"0d28bfb14ddca2b2579d0840bb92a951cb6cee45","bugs":{"url":"https://github.com/emileindik/poker-odds-machine/issues"},"homepage":"https://github.com/emileindik/poker-odds-machine#readme","_id":"@alexjamesmalcolm/poker-odds-machine@1.0.3","_nodeVersion":"14.17.4","_npmVersion":"8.1.1","dist":{"integrity":"sha512-CPDpFsRNw/4hYO5/H4fb21wkbkMUVgOi76L/260mY72WhZ3pgRTGIz+vbQwptNaNNuumD+ZhbXoRICiCK4DxMQ==","shasum":"e7f559afdb5491b133bdccd4c81128afc620dd78","tarball":"https://registry.npmjs.org/@alexjamesmalcolm/poker-odds-machine/-/poker-odds-machine-1.0.3.tgz","fileCount":20,"unpackedSize":96429,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDzXsQRZoTs/GVZ/zaJToIIimOVQ0FIS1w32s4j1TbtpQIgWIQEMXe4AMizFnGVevNRDACfsUOPVxC75bfz9YaIfJI="}]},"_npmUser":{"name":"alexjamesmalcolm","email":"alexjamesmalcolm@gmail.com"},"directories":{},"maintainers":[{"name":"alexjamesmalcolm","email":"alexjamesmalcolm@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/poker-odds-machine_1.0.3_1636841914531_0.4904395529627694"},"_hasShrinkwrap":false},"1.0.4":{"name":"@alexjamesmalcolm/poker-odds-machine","version":"1.0.4","description":"Poker odds machine (calculator)","main":"dist/index.js","types":"index.ts","private":false,"scripts":{"test":"node dist/test/index.js","build":"rm -rf dist && tsc","watch":"tsc -w","prepublishOnly":"npm run build"},"author":{"name":"Emile Indik"},"repository":{"type":"git","url":"git+https://github.com/emileindik/poker-odds-machine.git"},"keywords":["poker","odds","calculator"],"license":"MIT","devDependencies":{"@types/node":"^14.17.33","typescript":"^3.9.5"},"gitHead":"aa418f0c11a54910035f73e515c2544d85213e2b","bugs":{"url":"https://github.com/emileindik/poker-odds-machine/issues"},"homepage":"https://github.com/emileindik/poker-odds-machine#readme","_id":"@alexjamesmalcolm/poker-odds-machine@1.0.4","_nodeVersion":"14.17.4","_npmVersion":"8.1.1","dist":{"integrity":"sha512-b+OazNz7epBegNI4SOwwjv6Ya7e+uLB/7KvAmyBjtxgsW8lH3kaVUqBA5rOiFe591uwNkjvj0wRbsyzZqDvQrQ==","shasum":"386c4762cb04010eac85e309ff92da8943984f8a","tarball":"https://registry.npmjs.org/@alexjamesmalcolm/poker-odds-machine/-/poker-odds-machine-1.0.4.tgz","fileCount":20,"unpackedSize":95686,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICpCvz8t00qsSiTV+pquzxpPj+K53ft+x2pxLCe5RUcPAiA0JrLH+aOoUN7ZviQ9qq1C5CmKulRwjOfyXHCmekwU7A=="}]},"_npmUser":{"name":"alexjamesmalcolm","email":"alexjamesmalcolm@gmail.com"},"directories":{},"maintainers":[{"name":"alexjamesmalcolm","email":"alexjamesmalcolm@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/poker-odds-machine_1.0.4_1636842329610_0.011234564405861347"},"_hasShrinkwrap":false},"1.0.2":{"name":"@alexjamesmalcolm/poker-odds-machine","version":"1.0.2","description":"Poker odds machine (calculator)","main":"dist/index.js","types":"index.ts","scripts":{"test":"jest","build":"rm -rf dist && tsc","watch":"tsc -w","prepublishOnly":"npm run build"},"author":{"name":"Emile Indik"},"repository":{"type":"git","url":"git+https://github.com/emileindik/poker-odds-machine.git"},"keywords":["poker","odds","calculator"],"license":"MIT","devDependencies":{"@types/node":"^14.0.22","jest":"^27.3.1","ts-jest":"^27.0.7","ts-node":"^10.4.0","typescript":"^3.9.5"},"gitHead":"6447c1082b460ac492eb59ce05355f2778fe4070","bugs":{"url":"https://github.com/emileindik/poker-odds-machine/issues"},"homepage":"https://github.com/emileindik/poker-odds-machine#readme","_id":"@alexjamesmalcolm/poker-odds-machine@1.0.2","_nodeVersion":"14.17.4","_npmVersion":"8.1.1","dist":{"integrity":"sha512-6FpuhISsCfzwMwtkOJEGTeS9B8tPLSIWkVMsKNWJjSlrAO32+8wLpnXcGo0qmTdHJbXIVM3gQoirgM1hXLoMmQ==","shasum":"056cb3638ba1ee1c7854a0f5ab4c25294c24171e","tarball":"https://registry.npmjs.org/@alexjamesmalcolm/poker-odds-machine/-/poker-odds-machine-1.0.2.tgz","fileCount":27,"unpackedSize":102544,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCs7dm4Py0BkDAxajqgIR5oE4gK0Weu1bikuSFIMARkYgIgTfaKRLWXW8zlfsPX2eYmaBccAX71N0XqKQ91reO5sQc="}]},"_npmUser":{"name":"alexjamesmalcolm","email":"alexjamesmalcolm@gmail.com"},"directories":{},"maintainers":[{"name":"alexjamesmalcolm","email":"alexjamesmalcolm@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/poker-odds-machine_1.0.2_1636926019227_0.8132379838118098"},"_hasShrinkwrap":false},"1.1.0":{"name":"@alexjamesmalcolm/poker-odds-machine","version":"1.1.0","description":"Poker odds machine (calculator)","main":"dist/index.js","types":"index.ts","scripts":{"test":"jest","build":"rm -rf dist && tsc","watch":"tsc -w","prepublishOnly":"npm run build"},"author":{"name":"Emile Indik"},"repository":{"type":"git","url":"git+https://github.com/emileindik/poker-odds-machine.git"},"keywords":["poker","odds","calculator"],"license":"MIT","devDependencies":{"@types/node":"^14.0.22","jest":"^27.3.1","ts-jest":"^27.0.7","ts-node":"^10.4.0","typescript":"^3.9.5"},"gitHead":"784ed9c718b5c94a3aa3a2c48dcc39a9d1c8d891","bugs":{"url":"https://github.com/emileindik/poker-odds-machine/issues"},"homepage":"https://github.com/emileindik/poker-odds-machine#readme","_id":"@alexjamesmalcolm/poker-odds-machine@1.1.0","_nodeVersion":"14.17.4","_npmVersion":"8.1.1","dist":{"integrity":"sha512-l/S64QNCK8ZEKf8cI2AW7s9r6/vG4Zy7xb+qUNJ6rdlJR/GWEKEnZVfbZTM+wo1qDJ2ljiqZSjiMIVNDeVirDQ==","shasum":"9ef202133b40251fa0b9baaa4339432eb3f2c466","tarball":"https://registry.npmjs.org/@alexjamesmalcolm/poker-odds-machine/-/poker-odds-machine-1.1.0.tgz","fileCount":23,"unpackedSize":101590,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEMkBDnaOKdP3NP2xvMZoWTVeJJatvgwT6l0nCxBpZ/kAiANTT5oVWBwyH4UVWeZhoPRsbjAI7xvpXLiBCLwq0wlew=="}]},"_npmUser":{"name":"alexjamesmalcolm","email":"alexjamesmalcolm@gmail.com"},"directories":{},"maintainers":[{"name":"alexjamesmalcolm","email":"alexjamesmalcolm@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/poker-odds-machine_1.1.0_1636926352586_0.1487586679813615"},"_hasShrinkwrap":false},"1.1.1":{"name":"@alexjamesmalcolm/poker-odds-machine","version":"1.1.1","description":"Poker odds machine (calculator)","main":"dist/index.js","types":"index.ts","scripts":{"test":"jest","build":"rm -rf dist && tsc","watch":"tsc -w","prepublishOnly":"npm run build"},"author":{"name":"Emile Indik"},"repository":{"type":"git","url":"git+https://github.com/emileindik/poker-odds-machine.git"},"keywords":["poker","odds","calculator"],"license":"MIT","devDependencies":{"@types/node":"^14.0.22","jest":"^27.3.1","ts-jest":"^27.0.7","ts-node":"^10.4.0","typescript":"^3.9.5"},"gitHead":"7cc90af01a99af4826f72cfd0c12a5c41a83761a","bugs":{"url":"https://github.com/emileindik/poker-odds-machine/issues"},"homepage":"https://github.com/emileindik/poker-odds-machine#readme","_id":"@alexjamesmalcolm/poker-odds-machine@1.1.1","_nodeVersion":"14.17.4","_npmVersion":"8.1.1","dist":{"integrity":"sha512-Jyp6DNMF7FCco8DQGb6PCm8zuN9CJzPeK3uH84hPHQCSxiH8OUJzfxTjap5bI1Aw6oYEnkzRdMwg7vGjj7RsVw==","shasum":"3fc7728d3a2d801c465296e7958c457a22f0699a","tarball":"https://registry.npmjs.org/@alexjamesmalcolm/poker-odds-machine/-/poker-odds-machine-1.1.1.tgz","fileCount":23,"unpackedSize":102162,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhxI+wCRA9TVsSAnZWagAAWfIP/jqERzm95qRS1VPRo679\nxO0MsCW6ORAhqfO4O1IgPuhwIXZFeBFUEtotrgKzsVXWeXDymC/GJTPmN/v6\n/Z1kMuXEVB2oan4bDtdf4HVeD2tWKUiiCWOuk0VAm5lLZ7RONeYiBLOSNYCy\nC+Lg/KaR8XvkV5O9It2WXrfcOBKgce4CDIDbWmBdLQMt8LbwRQoX+kxWPnH8\n9ytohZPy/4hMZPIA6cN51R0CD/wwlZw8GUwEj4V123mKZ4eUi7rG1uvjxSUn\new7o6SL/kcU2Ue1pDxZTokdnc0Vy0fcWb7I/p6vdTZS0VAA8jf6MpSIB/jEn\ngACVss7WT2ajoLCpwx2TbaCHG8g9WgUmC+1Yv6CZs2MHqq63ZLXRryul/Pui\ncGtqMHXQKeDngKoKNZ8I22kAKcD85I9zjX87ArA2f1eDvWw4L8JsMu9Fm6yz\nu1NcFMj6Q4LasoZp8LohA/W6JZ1PpVpLtN6YbbVAo0SeN198yR7GBsoHdoT2\nGXA+pZCPVK5QCsF3lhCTnolHEBRNxZdpt0+6b0SroRxJQBSauXG/v7zFnf1I\nh7ayhX/9k9+e3bX1QekSDE/CHqvQbm0EmdV4T/MSJoJvS7RiM4WsBISyQEGe\n64pA/ZTPKmHf8pmZWYao1fzKglruag4dCiqKATs7LYMCc8gq3SxM2XBKiPPJ\njJQ/\r\n=SyZv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDhyr0J9Io5DR+S0czkInb70BXgGp/Gxift7HWHuqCIzAiA9mvnirQ4IR3KlTmNCWXDmbMyBrzYFnJNuoIhDr+BEKw=="}]},"_npmUser":{"name":"alexjamesmalcolm","email":"alexjamesmalcolm@gmail.com"},"directories":{},"maintainers":[{"name":"alexjamesmalcolm","email":"alexjamesmalcolm@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/poker-odds-machine_1.1.1_1636926861558_0.9962264790805166"},"_hasShrinkwrap":false}},"time":{"created":"2021-11-13T22:18:34.457Z","1.0.3":"2021-11-13T22:18:34.672Z","modified":"2022-04-04T12:40:47.931Z","1.0.4":"2021-11-13T22:25:29.958Z","1.0.2":"2021-11-14T21:40:19.363Z","1.1.0":"2021-11-14T21:45:52.790Z","1.1.1":"2021-11-14T21:54:21.699Z"},"maintainers":[{"name":"alexjamesmalcolm","email":"alexjamesmalcolm@gmail.com"}],"description":"Poker odds machine (calculator)","homepage":"https://github.com/emileindik/poker-odds-machine#readme","keywords":["poker","odds","calculator"],"repository":{"type":"git","url":"git+https://github.com/emileindik/poker-odds-machine.git"},"author":{"name":"Emile Indik"},"bugs":{"url":"https://github.com/emileindik/poker-odds-machine/issues"},"license":"MIT","readme":"# poker-odds-machine\n\n> Uses Monte Carlo simulation to estimate win probability of any poker hand.  \n> Check it out in action at https://emileindik.com/projects/poker.html (Heroku will probably be sleepy and need to wake up, so give it a minute)\n\n## Install\n\n```sh\nnpm install poker-odds-machine\n```\n\n## Usage\n\n```ts\nconst Calculator = require('poker-odds-machine').Calculator;\nconst input = {\n    /**\n     * Hands of players, following the syntax below.\n     * A player can have a partial hand (one card specified) in order\n     * to have their next card randomly selected.\n     * If hands option not supplied, then numPlayers must be provided.\n     */\n    hands: ['Ac,Kc', '2h,7d', 'Js'],\n    /**\n     * If not supplied, defaults to length of hands array.\n     * For every player above the length of hands array,\n     * a NPC will be created and dealt random cards.\n     */\n    numPlayers: 4,\n    /**\n     * Defaults to empty board, which is populated with number of\n     * cards specified in boardSize option.\n     */\n    board: 'Td,2d,Qc',\n    /**\n     * Defaults to 5.\n     */\n    boardSize: 5,\n    /**\n     * Defaults to 2.\n     */\n    handSize: 2,\n    /**\n     * Defaults to 1.\n     */\n    numDecks: 1,\n    /**\n     * If true, returns additional data containing stats on each player's winning hands.\n     * Defaults to false.\n     */\n    returnHandStats: true,\n    /**\n     * If true, returns additional data containing stats on each player's tied hands.\n     * Defaults to false.\n     */\n    returnTieHandStats: true,\n    /**\n     * Number of iterations in the Monte Carlo simulation to perform.\n     * The more iterations, the more accurate the returned probabilities,\n     * but the longer the calculation takes.\n     * Defaults to 1000.\n     */\n    iterations: 1000000,\n};\n\nconst c = new Calculator(input);\nconst s = c.simulate();\nconsole.log(s);\n```\n\n<details><summary>Super verbose sample output</summary>\n\n```\n{\n  'Ac,Kc': {\n    winCount: 280171,\n    tieCount: 6678,\n    handStats: {\n      highCard: { count: 0, percent: 0 },\n      pair: { count: 95106, percent: 9.5106 },\n      twoPair: { count: 30744, percent: 3.0744 },\n      trips: { count: 5180, percent: 0.518 },\n      straight: { count: 104479, percent: 10.4479 },\n      flush: { count: 43626, percent: 4.3626 },\n      fullHouse: { count: 0, percent: 0 },\n      quads: { count: 0, percent: 0 },\n      straightFlush: { count: 1036, percent: 0.1036 }\n    },\n    tieHandStats: {\n      highCard: { count: 0, percent: 0 },\n      pair: { count: 775, percent: 0.0775 },\n      twoPair: { count: 1603, percent: 0.1603 },\n      trips: { count: 19, percent: 0.0019 },\n      straight: { count: 4281, percent: 0.4281 },\n      flush: { count: 0, percent: 0 },\n      fullHouse: { count: 0, percent: 0 },\n      quads: { count: 0, percent: 0 },\n      straightFlush: { count: 0, percent: 0 }\n    },\n    winPercent: 28.0171,\n    tiePercent: 0.6678\n  },\n  '2h,7d': {\n    winCount: 284788,\n    tieCount: 17209,\n    handStats: {\n      highCard: { count: 0, percent: 0 },\n      pair: { count: 39160, percent: 3.916 },\n      twoPair: { count: 140578, percent: 14.0578 },\n      trips: { count: 48312, percent: 4.8312 },\n      straight: { count: 0, percent: 0 },\n      flush: { count: 32751, percent: 3.2751 },\n      fullHouse: { count: 22944, percent: 2.2944 },\n      quads: { count: 1043, percent: 0.1043 },\n      straightFlush: { count: 0, percent: 0 }\n    },\n    tieHandStats: {\n      highCard: { count: 0, percent: 0 },\n      pair: { count: 2544, percent: 0.2544 },\n      twoPair: { count: 11370, percent: 1.137 },\n      trips: { count: 1840, percent: 0.184 },\n      straight: { count: 0, percent: 0 },\n      flush: { count: 0, percent: 0 },\n      fullHouse: { count: 1455, percent: 0.1455 },\n      quads: { count: 0, percent: 0 },\n      straightFlush: { count: 0, percent: 0 }\n    },\n    winPercent: 28.4788,\n    tiePercent: 1.7209\n  },\n  Js: {\n    winCount: 191810,\n    tieCount: 11826,\n    handStats: {\n      highCard: { count: 0, percent: 0 },\n      pair: { count: 54926, percent: 5.4926 },\n      twoPair: { count: 33710, percent: 3.371 },\n      trips: { count: 11381, percent: 1.1381 },\n      straight: { count: 81774, percent: 8.1774 },\n      flush: { count: 4881, percent: 0.4881 },\n      fullHouse: { count: 4907, percent: 0.4907 },\n      quads: { count: 231, percent: 0.0231 },\n      straightFlush: { count: 0, percent: 0 }\n    },\n    tieHandStats: {\n      highCard: { count: 0, percent: 0 },\n      pair: { count: 464, percent: 0.0464 },\n      twoPair: { count: 4559, percent: 0.4559 },\n      trips: { count: 366, percent: 0.0366 },\n      straight: { count: 5835, percent: 0.5835 },\n      flush: { count: 0, percent: 0 },\n      fullHouse: { count: 602, percent: 0.0602 },\n      quads: { count: 0, percent: 0 },\n      straightFlush: { count: 0, percent: 0 }\n    },\n    winPercent: 19.181,\n    tiePercent: 1.1826\n  },\n  'NPC 1': {\n    winCount: 213260,\n    tieCount: 24612,\n    handStats: {\n      highCard: { count: 0, percent: 0 },\n      pair: { count: 66905, percent: 6.6905 },\n      twoPair: { count: 76426, percent: 7.6426 },\n      trips: { count: 21628, percent: 2.1628 },\n      straight: { count: 10761, percent: 1.0761 },\n      flush: { count: 24377, percent: 2.4377 },\n      fullHouse: { count: 12442, percent: 1.2442 },\n      quads: { count: 671, percent: 0.0671 },\n      straightFlush: { count: 50, percent: 0.005 }\n    },\n    tieHandStats: {\n      highCard: { count: 0, percent: 0 },\n      pair: { count: 3783, percent: 0.3783 },\n      twoPair: { count: 10083, percent: 1.0083 },\n      trips: { count: 1645, percent: 0.1645 },\n      straight: { count: 7976, percent: 0.7976 },\n      flush: { count: 0, percent: 0 },\n      fullHouse: { count: 1125, percent: 0.1125 },\n      quads: { count: 0, percent: 0 },\n      straightFlush: { count: 0, percent: 0 }\n    },\n    winPercent: 21.326,\n    tiePercent: 2.4612\n  }\n}\n```\n\n</details>\n\nDisclaimer:  \nI do not bound the value of most of the options, such as `handSize` and `boardSize`, on purpose. So have fun messin some shiz up with totally crazy options values, but know I haven't tested this library with outlier options values.\n\n## Setup\n\n```sh\nnpm install\nnpm run build\nnpm test\n┌─────────┬─────────────────┬───────────┬─────────────┬─────────┐\n│ (index) │      hand       │  % hypo   │ % estimated │ % error │\n├─────────┼─────────────────┼───────────┼─────────────┼─────────┤\n│    0    │   'highCard'    │ 17.41192  │   17.4821   │ 0.4031  │\n│    1    │     'pair'      │ 43.822546 │   43.8405   │  0.041  │\n│    2    │    'twoPair'    │ 23.495536 │   23.4381   │ -0.2445 │\n│    3    │     'trips'     │  4.82987  │    4.815    │ -0.3079 │\n│    4    │   'straight'    │ 4.619382  │   4.6163    │ -0.0667 │\n│    5    │     'flush'     │ 3.025494  │   3.0321    │ 0.2183  │\n│    6    │   'fullHouse'   │ 2.596102  │   2.5828    │ -0.5124 │\n│    7    │     'quads'     │ 0.168067  │   0.1623    │ -3.4314 │\n│    8    │ 'straightFlush' │ 0.031083  │   0.0308    │ -0.9105 │\n└─────────┴─────────────────┴───────────┴─────────────┴─────────┘\n```\n\nThe test calculates estimated probability for all hands and compares them against their true hypothetical value (% hypo).\n","readmeFilename":"README.md"}