Class

BlackJackPlayer

BlackJackPlayer(rng)

A blackjack player

Constructor

# new BlackJackPlayer(rng)

Parameters:
Name Type Description
rng seedrandom.PRNG

the random number generator

View Source core/src/Games/BlackJack/Player.ts, line 9

Members

Array.<BlackJackCard>

# cardHistory

Get the players card history

View Source core/src/Games/BlackJack/Player.ts, line 66

number

# cardSum

The sum of all player cards

View Source core/src/Games/BlackJack/Player.ts, line 30

BlackJackCard | undefined

# currentCard

The players current card

View Source core/src/Games/BlackJack/Player.ts, line 41

boolean

# hasUsableAce

Return whether the player has a usable ace

View Source core/src/Games/BlackJack/Player.ts, line 55

number

# score

The players score

View Source core/src/Games/BlackJack/Player.ts, line 21

boolean

# sticks

Get whether the player sticks

View Source core/src/Games/BlackJack/Player.ts, line 48

Methods

# addCard(blackJackCard) → {void}

hand the player a card

Parameters:
Name Type Description
blackJackCard BlackJackCard

The card to hand

View Source core/src/Games/BlackJack/Player.ts, line 185

void

# callStick() → {void}

call stick

View Source core/src/Games/BlackJack/Player.ts, line 177

void

# cardHistory() → {Array}

Get the players card history

View Source core/src/Games/BlackJack/Player.ts, line 156

Array

# cardSum() → {number}

The sum of all player cards

View Source core/src/Games/BlackJack/Player.ts, line 124

number

# currentCard() → {BlackJackCard|undefined}

The players current card

View Source core/src/Games/BlackJack/Player.ts, line 132

BlackJackCard | undefined

# hasUsableAce() → {boolean}

Return whether the player has a usable ace

View Source core/src/Games/BlackJack/Player.ts, line 148

boolean

# init() → {void}

Initialize the player

View Source core/src/Games/BlackJack/Player.ts, line 163

void

# reset() → {void}

Reset the player

View Source core/src/Games/BlackJack/Player.ts, line 170

void

# score() → {number}

The players score

View Source core/src/Games/BlackJack/Player.ts, line 116

number

# sticks() → {boolean}

Get whether the player sticks

View Source core/src/Games/BlackJack/Player.ts, line 140

boolean