Documentation

Table
in package

A game of blackjack between the dealer and a player.

Table of Contents

Properties

$dealerHand  : Hand
$playerHand  : Hand
$deck  : Deck

Methods

__construct()  : mixed
deal()  : void
Deal the initial 4 cards (2 for player, 2 for dealer)
dealerHitsUntil()  : void
Dealer draws cards until their hand has a value >= $limit
gameOver()  : bool
Check if the game is forcibly over (a hand has blackjack or busted)
getPlayerResult()  : Result
Get the result of the completed game from the player's perspective
playerHits()  : void
Player draws a card

Properties

Methods

__construct()

public __construct([bool $deal = true ]) : mixed
Parameters
$deal : bool = true

deal()

Deal the initial 4 cards (2 for player, 2 for dealer)

public deal() : void

dealerHitsUntil()

Dealer draws cards until their hand has a value >= $limit

public dealerHitsUntil(int $limit) : void
Parameters
$limit : int

gameOver()

Check if the game is forcibly over (a hand has blackjack or busted)

public gameOver() : bool
Return values
bool

getPlayerResult()

Get the result of the completed game from the player's perspective

public getPlayerResult() : Result
Return values
Result

playerHits()

Player draws a card

public playerHits() : void

        
On this page

Search results