blackjack-player
v1.1.0
Published
This module provides functionality for simulating a player's hand in a game of Blackjack. It utilizes the `blackjack-dealer` module to draw cards and display the current hand.
Readme
Blackjack Player Module
This module provides functionality for simulating a player's hand in a game of Blackjack. It utilizes the blackjack-dealer module to draw cards and display the current hand.
Installation
To install the module, use npm:
npm install blackjack-playerUsage
First, require the module in your project:
const { playerHand } = require('blackjack-player');
const { draw, showCard } = require('blackjack-dealer');Then, you can use the playerHand function to simulate a player's hand:
let handValues = playerHand(draw, showCard);
console.log(handValues);Functions
playerHand(draw, showCard)
Simulates a player's hand in Blackjack.
Parameters
draw: A function fromblackjack-dealerthat draws a card.showCard: A function fromblackjack-dealerthat displays the current hand.
Returns
- An array of hand values, including "Blackjack!" if the hand equals 21, or "Bust!" if the hand exceeds 21.
Example
const { playerHand } = require('blackjack-player');
const { draw, showCard } = require('blackjack-dealer');
let handValues = playerHand(draw, showCard);
console.log(handValues);License
This project is licensed under the MIT License.
