Home Reference Source
import Deck from 'cards/src/deck.js'
public class | source

Deck

Extends:

EventEmitter → Deck

For shuffling and dealing

Static Method Summary

Static Public Methods
public static
public static

overhandShuffle(deck: string[]]): string[]]

Mimics the standard shuffling technique

public static

score(cards: string[], aceLow: boolean): number

Returns the sum of the value of their cards according to pontoon rules

public static

shiftHalf(cards: string[], quantity: number, deck: string[]]): string[]]

Pushes a quantity of cards into another

public static

sum(arr: number[]): number

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

cards: *

public get

Method Summary

Public Methods
public

Mimics the stand shuffling technique of humans

public

Splits the deck in two, then interleaves the cards to form a new deck

Static Public Methods

public static buildDeck(): string[] source

Return:

string[]

deck

public static overhandShuffle(deck: string[]]): string[]] source

Mimics the standard shuffling technique

Params:

NameTypeAttributeDescription
deck string[]]

Deck to push the cards into

Return:

string[]]

deck

public static score(cards: string[], aceLow: boolean): number source

Returns the sum of the value of their cards according to pontoon rules

Params:

NameTypeAttributeDescription
cards string[]

e.g. ['A♤', '9♡'];

aceLow boolean

Whether aces should be valued as one or eleven

Return:

number

public static shiftHalf(cards: string[], quantity: number, deck: string[]]): string[]] source

Pushes a quantity of cards into another

Params:

NameTypeAttributeDescription
cards string[]

The source of the cards to push

quantity number

How many cards to take from each half

deck string[]]

Deck to push the cards into

Return:

string[]]

deck

public static sum(arr: number[]): number source

Params:

NameTypeAttributeDescription
arr number[]

Return:

number

Public Constructors

public constructor source

Public Members

public cards: * source

public get topCard: string: * source

Return:

string

A card from the top of the deck

Public Methods

public overhandShuffle(): string[] source

Mimics the stand shuffling technique of humans

Return:

string[]

cards A shuffled deck of cards

public riffleShuffle(times: number): string[] source

Splits the deck in two, then interleaves the cards to form a new deck

Params:

NameTypeAttributeDescription
times number
  • optional
  • default: 1

Quantity of times shuffle executed

Return:

string[]

cards A shuffled deck of cards