Giter Site home page Giter Site logo

artifact_deck_code's Introduction

ArtifactDeckCode

Encoder and decoder for decks of the Artifact game. See reference coder by Valve.

Documentation is available online.

Usage

Decode a deck code string:

iex> ArtifactDeckCode.decode("ADCJWkTZX05uwGDCRV4XQGy3QGLmqUBg4GQJgGLGgO7AaABR3JlZW4vQmxhY2sgRXhhbXBsZQ__")
{:ok,
 %{
   cards: [
     {3000, 2},
     {3001, 1},
     {10091, 3},
     ...
   ],
   heroes: [{4005, 2}, {10014, 1}, {10017, 3}, {10026, 1}, {10047, 1}],
   name: "Green/Black Example"
 }}

Encode a deck:

iex> ArtifactDeckCode.encode(%{name: "Optional deck name",
...>    heroes: [{4000, 1}, {4003, 1}, {10054, 1}, {10014, 2}, {10070, 3}],
...>    cards: [{3000, 2}, {3001, 2}, {3002, 2}],
...> })
{:ok, "ADCJecRIH0De7sBKAGQeF1BQVJlZC9HcmVlbiBCcmF3bGVy"}

Deck format

A deck is just a map with keys :heroes, :cards and an optional key :name.

heroes is a list of {hero_card_id, hero_entrance_turn}.

cards is a list of {card_id, card_count}.

Installation

The package can be installed by adding artifact_deck_code to your list of dependencies in mix.exs:

def deps do
  [
    {:artifact_deck_code, "~> 0.1.0"}
  ]
end

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.