CLI utility for interacting with a deck of cards. You can draw a random card or cards from various types of decks (standard, euchre, pinochle, or canasta). You can also deal a hand for several card games: blackjack, poker, euchre, pinochle, canasta, gin, or rummy.
npm install -g card-dealer-cliThere are two commands available: pick-a-card and deal-a-hand
Usage: card-dealer [options] [command]
Options:
-p, --perfect-shuffle Should all randomness be removed when shuffling the deck? (default:false)
-t, --shuffle-times <times> How many times should we shuffle the deck? (default: 7)
--cut [Y/n] Do you want to cut the deck after shuffling?
-h, --help display help for command
Commands:
pick-a-card [options] Pick a random card or cards from a deck
deal-a-hand [options] Deal a hand for one of several types of card games
help [command] display help for commandPick a random card (or multiple cards) from a deck of cards.
(This is the default command, so it will run if you don't specify another command)
Usage: card-dealer pick-a-card [options]
Pick a random card or cards from a deck
Options:
-d, --deck <deck-type> What type of deck should we use (choices: "standard", "double", "euchre", "canasta", "pinochle", default: "standard")
-c, --count <number> How many cards should be chosen? (default: 1)
--top Should the card be pulled from the top of the deck, rather than at a random point in the deck? (default: false)
-h, --help display help for commandPick a random card from a standard 52 card deck:
card-dealerCut the deck after shuffling without being prompted
card-dealer pick-a-card --cutDo not shuffle or cut the deck and pick a card off the top of the deck. (This will not be random at all).
card-dealer pick-a-card --shuffle-times 0 --cut n --topPick two random cards from a canata deck:
card-dealer pick-a-card --deck canasta --count 2Deal the initial hand for several types of cards games: blackjack, poker, euchre, pinochle, canasta, gin or rummy.
Usage: card-dealer deal-a-hand [options]
Deal a hand for one of several types of card games
Options:
-g, --game <game-type> What card game should we deal a hand for? (choices: "blackjack", "poker", "euchre", "pinochle", "canasta", "gin", "rummy")
-h, --help display help for commandDeal hand, being prompted for what game
card-dealer deal-a-handDeal a game of Texas hold 'em poker
card-dealer deal-a-hand --game pokerDeal a game Euchre without shuffling, only cutting the deck once
card-dealer deal-a-hand --game euchre --shuffle-times 0 --cutIn addition to the CLI utility, you can also import the underlying classes and objects for use in your own application.
npm install card-dealer-cliimport { StandardDeck, CanastaDeck } from 'card-dealer-cli'
const deck = new StandardDeck()
const canastaDeck = new CanastaDeck()
console.log(deck.count) # => 52
console.log(canastaDeck.count) # => 108
# Shuffle the deck three times
deck.riffleShuffle(3)
# Cut the deck
deck.cut()
const hands = deck.dealHands({ cardsPerHand: 5, numberOfHands: 3 })
console.log(hands[0].showCards()) # => ♠️ J ♣️ 2 ♣️ 5 ♥ 3 ♦ 2See the BaseDeck definition for available functions on deck objects and in deck.ts for the types of decks available. Look in the lib directory for defintions of other objects such as Card and Hand

