cardEncoder

Creates a encoder that encodes/decodes one card.

cardEncoder
Parameters
idx (Number? = 0) index in the bits at which the encoded card is located
Returns
CardEncoder: a card encoder with encode(String card) and decode(Number bits) methods

cardsEncoder

Creates a encoder that encodes/decodes a specific number of cards.

cardsEncoder
Parameters
n (Number) the number of cards to encode/decode
idx (Number? = 0) index in the bits at which the encoded cards are located
Returns
CardsEncoder: a card encoder with encode(String cards) and decode(Number bits) methods

CARD_NOT_PRESENT

A 2 char string indicating a non present card as '??'.

CARD_NOT_PRESENT

Type: String

CardEncoder.encode

Encodes a card.

The idx is taken into account so that an | operation allows including the encoded information into existing bits.

CardEncoder.encode
Parameters
card (String) the card to encode
Returns
Number: the bits representing that card

CardEncoder.decode

Decodes a card.

The idx is taken into account so that the card can be decoded from within anywhere inside the given bits.

CardEncoder.decode
Parameters
allBits (Number) the bits in which a card is encoded
Returns
String: the decoded card

CardsEncoder.encode

Encodes a number of cards.

The idx is taken into account so that an | operation allows including the encoded information into existing bits.

CardsEncoder.encode
Parameters
cards (Array<String>) the cards to encode
Returns
Number: the bits representing the cards

CardsEncoder.decode

Encodes a number of cards.

The idx is taken into account so that an | operation allows including the encoded information into existing bits.

CardsEncoder.decode
Parameters
allBits (Number) the bits in which the cards are encoded
Returns
Array<String>: the decoded cards