@splithyperion56/poker-hand
v1.0.0
Published
Simple package to create a poker hand creator and evaluator
Downloads
4
Readme
Poker Hand
A simple node package to generate a poker hand (with options for size) and evaluate the hand rank.
Table of Contents
Installation
npm install @hyperion/poker-hand
Or for a local version
- Clone the repository:
git clone https://github.com/JordanHopcroft/poker-hand-assessment
- Install the dependencies:
npm install
- Create link to this package: 'npm link '
- Go to directory to use this package: 'npm link '
Usage
import Poker from 'poker-hand'
Or if using cjs
var Poker = require('poker-hand')
For testing the local version you can run:
npm run game
This will run a quick simulation.
API
play({shuffleCount, handSize})
- shuffleCount:
Number | null
: How many times to shuffle the deck before drawing cards. Default: 3. - handSize:
Number | null
: How many cards to draw. Default: 5.
Simulates a quick round of poker by shuffling a deck, drawing 5 cards to display and then ranks the hand that was drawn.
shuffle(times)
- times:
Number
Number of times to shuffle the deck. Default: 3
Shuffles the deck of cards and clears the current hand.
drawCards(handSize)
- handSize:
Number
Size of the hand to draw. Default: 5
Draws the first 5 cards from the deck.
evalHand()
Returns the ranking of the current hand.
showHand()
Prints the current hand to console.
Contributing
Contributions are welcome! Here's how you can contribute to this project:
- Fork the project
- Create your own branch:
git checkout -b new-feature
- Commit your changes:
git commit -m 'Add new feature'
- Push to the branch:
git push origin new-feature
- Submit a pull request
License
This project is licensed under the MIT License.