@splithyperion56/poker-hand

1.0.0 • Public • Published

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

  1. Clone the repository: git clone https://github.com/JordanHopcroft/poker-hand-assessment
  2. Install the dependencies: npm install
  3. Create link to this package: 'npm link '
  4. 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:

  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.

Readme

Keywords

Package Sidebar

Install

npm i @splithyperion56/poker-hand

Weekly Downloads

1

Version

1.0.0

License

ISC

Unpacked Size

16.4 kB

Total Files

16

Last publish

Collaborators

  • hyperion56