- python
- pip
You may want to use a virtual environment.
pip install -r requirements.txt
- main.py: execute this file to generate the decklist visualization
- savedecks.py: execute this file to crawl and save the current decklists of the cEDH decklist database
- cardstats.py: execute this file after savedecks.py to generate and save the card stats
- correlation.py: execute this file to generate the card visualization
- crawler.py: slightly modified copy of the cEDH Decklist Database crawler from https://anonymous.4open.science/r/cEDH-DDB-Crawler-D2E6
- cards.json: card attributes like type and mana cost from Scryfall, generate using mtgslides and copy here
tree.pdf: generated file containing the visualization
These files are generated by executing scripts in the py folder above.
links.json
: Decklist links of the cEDH decklist database as a JSON array of decklist links, mostly from moxfield. Generated bypy/savedecks.py
.decks.json
anddecks.js
: Decklists of the cEDH decklist database, Generated bypy/savedecks.py
.cards.json
andcards.js
: Card status of the cEDH decklist database. Generated bypy/cardstats.py
afterpy/savedecks.py
savedecks.py
and cardstats.py
are run daily in a GitHub workflow and deployed to data folder of the gh-pages branch.
If you want to generate the card visualization with correlation.py
but don't want to install Python or the required libraries, you can use Docker as follows:
docker build . -t mtgcompare
docker run mtgcompare
- https://cedh-decklist-database.com
- https://www.moxfield.com The moxfield API is inofficial and may break at any time.
This is how I generate the monthly cEDH staples posts at https://reddit.com/r/cedh, for example see July 2022.
python py/savedecks.py
python py/cardstats.py
Or download https://github.com/KonradHoeffner/cedh/raw/gh-pages/data/cards.json to dist/data
.
Download the comparison file at that point in time from GitHub and save it to dist/data/cards.old.json
.
python py/diff.py > diff.txt
Per request, only use the top two sections, top increased and top decreased.
- if
links.json
does not exist:- fetch decklist links from the Competitive EDH Decklist Database using a crawler based on https://anonymous.4open.science/r/cEDH-DDB-Crawler-D2E6
- save the result in
links.json
- if
decks.json
does not exist then for each moxfield decklist link:- replace https://www.moxfield.com/ with https://www.gerbrand.dev/
- fetch the resulting URL
- parse the content into a dictionary with decklist names as keys and lists of card names as values
- save the result in
decks.json
- remove very common lands and mana rocks from the decks
- transform the decks into binary vectors using a DictVectorizer
- perform agglomerative clustering
- create the linkage matrix
- visualize the linkage matrix as a tree of labelled nodes
- use different distance functions
- use commander identity and card color relative scores in visualization
- add graph not based on clustering but on distance cutoff