lordeckcode

package module
v0.6.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2023 License: MIT Imports: 8 Imported by: 1

README

lor-deckcode-go

Go Report Card Go Reference Test

a LoR deck encoder/decoder for Go

Installation

$ go get github.com/m0t0k1ch1/lor-deckcode-go

Documentation

Index

Constants

View Source
const (
	Format          uint8 = 1
	InitialVersion  uint8 = 1
	MaxKnownVersion uint8 = 5

	MaxKnownSet   uint64 = 8
	MaxCardNumber uint64 = 999

	CardCodeLength int = 7
)

Variables

View Source
var (
	ErrUnknownFormat  = errors.New("unknown format")
	ErrUnknownVersion = errors.New("unknown version")
	ErrUnknownSet     = errors.New("unknown set")
	ErrUnknownFaction = errors.New("unknown faction")

	ErrUnexpectedCardCount      = errors.New("unexpected card count")
	ErrUnexpectedCardNumber     = errors.New("unexpected card number")
	ErrUnexpectedCardCodeLength = errors.New("unexpected card code length")
)

Functions

func Encode

func Encode(deck Deck) (string, error)

Encode encodes a deck to a deck code.

Types

type CardCodeAndCount

type CardCodeAndCount struct {
	CardCode string `json:"cardCode"`
	Count    uint64 `json:"count"`
}

CardCodeAndCount represents a card code and count.

type Deck

type Deck []CardCodeAndCount

Deck represents a deck.

func Decode

func Decode(deckCode string) (Deck, error)

Decode decodes a deck code to a deck.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL