Skip to main content

A compact format to share decklists for Altered TCG

Project description

altered-deckfmt

This repository is a Python library of the original specification defined in Taum/altered-deckfmt.

A Compact format to share decklists for Altered TCG.

This binary format can be encoded to Base64 to share decks in URL-safe codes. As an example, a reasonable decklist such as:

1 ALT_CORE_B_YZ_03_C
3 ALT_CORE_B_BR_16_R2
2 ALT_CORE_B_YZ_04_C
3 ALT_CORE_B_YZ_07_R1
1 ALT_CORE_B_BR_10_R2
1 ALT_CORE_B_MU_08_R2
3 ALT_CORE_B_YZ_06_C
2 ALT_CORE_B_YZ_11_C
1 ALT_CORE_B_YZ_12_C
3 ALT_CORE_B_YZ_14_C
3 ALT_CORE_B_BR_25_R2
3 ALT_CORE_B_YZ_19_C
1 ALT_CORE_B_BR_28_R2
3 ALT_CORE_B_MU_25_R2
3 ALT_CORE_B_YZ_21_C
3 ALT_CORE_B_YZ_22_C
2 ALT_CORE_B_YZ_24_C
1 ALT_CORE_B_YZ_26_C
1 ALT_CORE_B_YZ_25_C

Can be encoded into the string:

EBAk3DNQrEPHVKmIvGLLHMPONZvTFcuZvVPWLYHaHZA=

This project provides a Python package that can be imported into a project.

Demo page to encode/decode decklists: https://taum.github.io/altered-deckfmt/

Note that this is a Python implementation of the original format specification, which I will try to keep up to date.

Installation

Install the PyPI package using pip.

pip install altered-deckfmt

Usage

Encode a decklist:

from altered_deckfmt import encode, EncodeException


decklist = """1 ALT_COREKS_B_AX_08_C
1 ALT_COREKS_B_AX_03_C
1 ALT_COREKS_B_AX_08_R1
"""

try:
    encoded_decklist = encode(decklist)
    print(encoded_decklist)
    # EBAQ0oEjEoQ=
except EncodeException:
    print("Failed to encode the decklist")

Decode a decklist:

from altered_deckfmt import decode, DecodeException


encoded_decklist = "EBAQ0oEjEoQ="

try:
    decklist = decode(encoded_decklist)
    print(decklist)
    # 1 ALT_COREKS_B_AX_08_C
    # 1 ALT_COREKS_B_AX_03_C
    # 1 ALT_COREKS_B_AX_08_R1
except DecodeException:
    print("Failed to decode the decklist")

Run Tests

python -m unittest discover tests

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

altered_deckfmt-0.1.1.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

altered_deckfmt-0.1.1-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file altered_deckfmt-0.1.1.tar.gz.

File metadata

  • Download URL: altered_deckfmt-0.1.1.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for altered_deckfmt-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8635c895a162ee8b011f01e09a35f7553a1eee33a53805905edb9800f9c13568
MD5 d5db50ae9f72222c20a9330e02b51119
BLAKE2b-256 fb002d7fc374b6ae621354ac5089efd2a1fe1d53d6ec234ccd9faa9a656b6aa1

See more details on using hashes here.

File details

Details for the file altered_deckfmt-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for altered_deckfmt-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 71be634cf07c92d9bab5cebef0b65bc514271792dad8c8cbb17ee66dfec877ca
MD5 8c544e709a0a3e5cda389f1e41eae192
BLAKE2b-256 f356b01d57140bdb09e61e273007de286285e93ee2d16a27182ea01600e6d090

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page