Class

BlackJackGame

BlackJackGame(randomSeednullable)

The Black Jack implementation is oriented on the logic described in Richard S. Sutton and Andrew G. Barto 'Reinforcement Learning: An Introduction' Example 5.1..

Constructor

# new BlackJackGame(randomSeednullable)

Parameters:
Name Type Attributes Description
randomSeed number <nullable>

the random seed

View Source core/src/Games/BlackJack/BackJackGame.ts, line 14

Members

Map.<BlackJackActionKey, BlackJackAction>

# readonly actionMapping

The action mapping

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

boolean

# isTerminal

Return whether the game has terminated

View Source core/src/Games/BlackJack/BackJackGame.ts, line 91

number

# iteration

Get the iteration

View Source core/src/Games/BlackJack/BackJackGame.ts, line 109

number

# randomSeed

Set the random seed

View Source core/src/Games/BlackJack/BackJackGame.ts, line 128

number

# return

Get The return

View Source core/src/Games/BlackJack/BackJackGame.ts, line 72

Map.<BlackJackActionKey, BlackJackAction>

# static readonly actionMapping

The action mapping

View Source core/src/Games/BlackJack/BackJackGame.ts, line 232

Array.<string>

# static actionSpace

Get the action space

View Source core/src/Games/BlackJack/BackJackGame.ts, line 65

Array.<number>

# static gameStateDim

Get the game state dimension

View Source core/src/Games/BlackJack/BackJackGame.ts, line 44

Methods

# endGame() → {void}

End the game

View Source core/src/Games/BlackJack/BackJackGame.ts, line 348

void

# initGame() → {void}

initialize the game

View Source core/src/Games/BlackJack/BackJackGame.ts, line 303

void

# isTerminal() → {boolean}

Return whether the game has terminated

View Source core/src/Games/BlackJack/BackJackGame.ts, line 280

boolean

# iteration() → {number}

Get the iteration

View Source core/src/Games/BlackJack/BackJackGame.ts, line 296

number

# playerHasNatural() → {boolean}

Return whether the player has a natural blackjack

View Source core/src/Games/BlackJack/BackJackGame.ts, line 318

whether the player has a natural blackjack

boolean

# randomSeed(randomSeed)

Set the random seed

Parameters:
Name Type Description
randomSeed number

View Source core/src/Games/BlackJack/BackJackGame.ts, line 311

# reset(reinitopt) → {boolean}

Reset the game

Parameters:
Name Type Attributes Default Description
reinit boolean <optional>
true

Whether to reinitialize the game

View Source core/src/Games/BlackJack/BackJackGame.ts, line 356

boolean

# return() → {number}

Get The return

View Source core/src/Games/BlackJack/BackJackGame.ts, line 272

number

# simulateDealer() → {void}

Simulate the dealer

View Source core/src/Games/BlackJack/BackJackGame.ts, line 333

void

# step(actionString) → {StepResult}

Make an environment step

Parameters:
Name Type Description
actionString BlackJackActionKey

The action

View Source core/src/Games/BlackJack/BackJackGame.ts, line 326

The result

StepResult

# static actionSpace() → {Array}

Get the action space

View Source core/src/Games/BlackJack/BackJackGame.ts, line 264

Array

# static encodeStateToIndices(state)

Encode the state to a number encoded array

Parameters:
Name Type Description
state BlackJackGameState

the state

View Source core/src/Games/BlackJack/BackJackGame.ts, line 341

the encoded array

# static gameStateDim() → {Array}

Get the game state dimension

View Source core/src/Games/BlackJack/BackJackGame.ts, line 240

Array