View Source Riot.LoR.DeckCode (Riot LoR v1.1.1)

Functions to encode/decode a LoR deck code.

Link to this section Summary

Functions

Takes a deck code and attempts to decode into a Riot.LoR.Deck.

Takes a Riot.LoR.Deck and encodes it into a deck code string.

Link to this section Functions

Link to this function

decode!(deck_code)

View Source (since 1.0.0)
@spec decode!(binary()) :: Riot.LoR.Deck.t()

Takes a deck code and attempts to decode into a Riot.LoR.Deck.

examples

Examples

iex> deck_code = "CEAAAAIBAEAAC"
iex> Riot.LoR.DeckCode.decode!(deck_code)
%{%Riot.LoR.Card{fac: 0, num: 1, set: 1} => 1}
Link to this function

encode!(deck, format \\ 1)

View Source (since 1.0.0)
@spec encode!(Riot.LoR.Deck.t(), pos_integer()) :: binary()

Takes a Riot.LoR.Deck and encodes it into a deck code string.

examples

Examples

iex> deck = Riot.LoR.Deck.new()
iex> deck = Riot.LoR.Deck.add_card(deck, %Riot.LoR.Card{set: 1, fac: 0, num: 1})
iex> Riot.LoR.DeckCode.encode!(deck)
"CEAAAAIBAEAAC"