@splithyperion56/poker-hand v1.0.0
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-handOr 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 gameThis 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:
NumberNumber of times to shuffle the deck. Default: 3
Shuffles the deck of cards and clears the current hand.
drawCards(handSize)
- handSize:
NumberSize 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:
1. Fork the project
2. Create your own branch: git checkout -b new-feature
3. Commit your changes: git commit -m 'Add new feature'
4. Push to the branch: git push origin new-feature
5. Submit a pull request
License
This project is licensed under the MIT License.
2 years ago