Spyke

How to check deck legality and build decks on a custom format?

Hi everyone, I’m trying to build decks for a custom format using this card pool (f:standard tix<=0.1 usd<=1). I have a deck here: deck link.

I know legality is ultimately whatever rules you define for a custom format, but I’m looking for a practical way to check a deck automatically against a specific pool, rather than checking each card one by one. For reference, Penny Dreadful has a deck legality checker. I’m wondering if there’s something similar for generic card pools, or if manual checking is the only option.

Is there an easy way to check if the deck is legal for this pool and identify any cards that aren’t allowed? Also, I’d love tips or strategies for making deckbuilding simple in a custom format like this. Thanks!

View original on mtgzone.com

Seems simple enough, so I'm going to try and make one myself. Here's the idea I have so far:

  1. User selects a default format or uploads a JSON list of legal cards.
  2. User pastes decklist text or uploads deck JSON.
  3. Script compares deck entries with legal list.
  4. Output = list of illegal cards.
1
mtgzone.com

When I try to validate a deck, I only see the message “Loading data, please wait…” and nothing happens. So I’m not sure if it’s a problem with my JSON export, the file path, or the validator itself.

1
mtgzone.com

I exported the Standard Penny collection from Moxfield to JSON using a Python script:

import csv
import json

input_csv = 'moxfield_haves_2025-10-21-1123Z.csv'
output_json = 'standard_penny.json'

sets = set()
cards = []

with open(input_csv, newline='', encoding='utf-8') as csvfile:
    reader = csv.DictReader(csvfile)
    for row in reader:
        name = row.get('Name')
        edition = row.get('Edition')
        if name:
            cards.append(name)
        if edition:
            sets.add(edition.upper())

sets = sorted(list(sets))

output_data = {
    "sets": sets,
    "cards": cards
}

with open(output_json, 'w', encoding='utf-8') as jsonfile:
    json.dump(output_data, jsonfile, indent=2)

print(f"JSON saved to {output_json}")

I saved the JSON file as validator/formats/standardpenny.json and added it to the validator’s config:

{ "name": "Standard Penny", "key": "standardpenny", "datafile":"formats/standardpenny.json" },

Then I tried to validate this deck exported as Plain Text from Moxfield and got the error.

1

I've managed to write another script that seems to work:

import json
import re

def load_legal_cards(json_file):
    """
    Load legal cards from a JSON file with structure:
    { "sets": [], "cards": [], "banned": [] }
    """
    with open(json_file, 'r', encoding='utf-8') as f:
        data = json.load(f)
    legal_cards = [card.lower() for card in data.get('cards', [])]
    banned_cards = [card.lower() for card in data.get('banned', [])] if 'banned' in data else []
    return legal_cards, banned_cards

def clean_line(line):
    """
    Remove quantities, set info, markers, and whitespace
    Skip lines that are section headers like 'Deck', 'Sideboard'
    """
    line = re.sub(r'^\d+\s*x?\s*', '', line)  # "2 " or "2x "
    line = re.sub(r'\(.*?\)', '', line)        # "(SET)"
    line = re.sub(r'\*\w+\*', '', line)        # "*F*"
    line = line.strip()
    if re.match(r'^(deck|sideboard)\s*:?\s*$', line, re.IGNORECASE):
        return None
    return line if line else None

def validate_deck(deck_file, legal_cards, banned_cards):
    """
    Returns a list of illegal cards
    """
    illegal_cards = []
    with open(deck_file, 'r', encoding='utf-8') as f:
        lines = f.readlines()

    for line in lines:
        card_name = clean_line(line)
        if not card_name or card_name.startswith("#"):
            continue  # skip empty or comment lines

        card_lower = card_name.lower()
        if card_lower in banned_cards or card_lower not in legal_cards:
            illegal_cards.append(card_name)

    return illegal_cards

def main():
    legal_cards_file = 'legal_cards.json'   # JSON with "cards" and optional "banned"
    decklist_file = 'decklist.txt'          # Your decklist input

    legal_cards, banned_cards = load_legal_cards(legal_cards_file)
    illegal_cards = validate_deck(decklist_file, legal_cards, banned_cards)

    if illegal_cards:
        print("Illegal cards:")
        for card in illegal_cards:
            print(card)

if __name__ == "__main__":
    main()
1

Check the console for errors? Or send me a link of where you got it published and I'll take a look.

1

I'm not aware of a single tool, but you could ensure the deck is standard legal in any normal deck building tool, then additionally check it against the Penny Dreadful deck checker - if it passes both, it should be legal in your format (assuming I understand what you're doing correctly.)

Edit: Nevermind, I see you're limiting it to $1, not $0.01, despite borrowing the name. Penny Dreadful checker won't work.

2

I’m not aware of a single tool, but you could ensure the deck is standard legal in any normal deck building tool, then additionally check it against the Penny Dreadful deck checker - if it passes both, it should be legal in your format (assuming I understand what you’re doing correctly.)

Edit: Nevermind, I see you’re limiting it to $1, not $0.01, despite borrowing the name. Penny Dreadful checker won’t work.

Yeah Penny Dreadful uses tix<=0.02 and this uses both tix<=0.1 and usd<=1

1

You reached the end

How to check deck legality and build decks on a custom format? | Spyke