Complete: Deck set assignment deck converter
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Complete: Deck set assignment deck converter
by Xitax » 12 Mar 2012, 06:07
Having been inspired by Agetian's script to assign set values to quest deck lands, I've gotten a fair bit into a script that will take a deck file and find the proper standard, extended, or vintage era and assign the cards in the deck file appropriately. No more Type 2 decks from 1999 with cards from tenth edition!
So here's my quandary and where I could use some help.
I'm trying to define every iteration of standard, and that's quite time consuming considering the research but somewhere around 1999 it becomes quite hard to understand what was allowed in standard. If somebody here would please step forward with some help or information I'd greatly appreciate it and finish up my fancy script.
This is what I have got so far, but again I'm not too sure about some of the older standard setlists. As you can see, I only need to fill out information in a txt file in a similar format (not finalized yet) in order to compare decklists.
Very alpha-state WIP output:

EDIT: Sorry for the long post; I was able to find the following info on the official 1998 tournament rules sheet:
So here's my quandary and where I could use some help.
I'm trying to define every iteration of standard, and that's quite time consuming considering the research but somewhere around 1999 it becomes quite hard to understand what was allowed in standard. If somebody here would please step forward with some help or information I'd greatly appreciate it and finish up my fancy script.
This is what I have got so far, but again I'm not too sure about some of the older standard setlists. As you can see, I only need to fill out information in a txt file in a similar format (not finalized yet) in order to compare decklists.
- Code: Select all
Standard DKA ISD M12 NPH MBS SOM
Standard ISD M12 NPH MBS SOM
Standard M12 NPH MBS SOM M11 ROE WWK ZEN
Standard NPH MBS SOM M11 ROE WWK ZEN
Standard MBS SOM M11 ROE WWK ZEN
Standard SOM M11 ROE WWK ZEN
Standard M11 ROE WWK ZEN M10 ARB CON ALA
Standard ROE WWK ZEN M10 ARB CON ALA
Standard WWK ZEN M10 ARB CON ALA
Standard ZEN M10 ARB CON ALA
Standard M10 ARB CON ALA EVE SHM MOR LRW
Standard ARB CON ALA EVE SHM MOR LRW 10E
Standard CON ALA EVE SHM MOR LRW 10E
Standard ALA EVE SHM MOR LRW 10E
Standard EVE SHM MOR LRW 10E PLC FUT TSP TSB
Standard SHM MOR LRW 10E PLC FUT TSP TSB CSP
Standard MOR LRW 10E PLC FUT TSP TSB CSP
Standard LRW 10E PLC FUT TSP TSB CSP
Standard 10E PLC FUT TSP TSB CSP DIS GPT RAV
Standard FUT PLC TSP TSB CSP DIS GPT RAV 9ED
Standard PLC TSP TSB CSP DIS GPT RAV 9ED
Standard TSP TSB CSP DIS GPT RAV 9ED
Standard DIS GPT RAV 9ED SOK BOK CHK
Standard GPT RAV 9ED SOK BOK CHK
Standard RAV 9ED SOK BOK CHK
Standard 9ED SOK BOK CHK 5DN DST MRD
Standard SOK BOK CHK 5DN DST MRD 8ED
Standard BOK CHK 5DN DST MRD 8ED
Standard CHK 5DN DST MRD 8ED
Standard 5DN DST MRD 8ED SCG LGN ONS
Standard DST MRD 8ED SCG LGN ONS
Standard MRD 8ED SCG LGN ONS
Standard 8ED SCG LGN ONS JUD TOR ODY
Standard SCG LGN ONS JUD TOR ODY 7ED
Standard LGN ONS JUD TOR ODY 7ED
Standard ONS JUD TOR ODY 7ED
Standard JUD TOR ODY 7ED APC PLS INV
Standard TOR ODY 7ED APC PLS INV
Standard ODY 7ED APC PLS INV
Standard APC 7ED PLS INV PCY NEM MMQ
Standard 7ED PLS INV PCY NEM MMQ
Standard PLS INV PCY NEM MMQ 6ED
Standard INV PCY NEM MMQ 6ED
Standard PCY NEM MMQ 6ED UDS ULG USG
Standard NEM MMQ 6ED UDS ULG USG
Standard MMQ 6ED UDS ULG USG
Standard 6ED UDS ULG USG EXO STH TMP
Very alpha-state WIP output:

EDIT: Sorry for the long post; I was able to find the following info on the official 1998 tournament rules sheet:
- Code: Select all
2.3.2 Expansion Set Rotation
Expansion sets rotate into play environments on the first day of the month following their retail release dates as described in section 2.1.5. However, they rotate out in "blocks." A given large expansion and its two smaller expansions--essentially a year of Magic expansions-- enters Standard play as a new "block" when the large expansion rotates into the environment.
Example: The Rath Cycle block rotated into the Standard tournament environment with the release of Tempest. The Stronghold and Exodus sets are Rath Cycle expansions, and are therefore part of this block. The Tempest, Stronghold, and Exodus expansions will rotate out of the tournament environment together when the 1999 large expansion enters the environment (two years after Tempest was introduced to the environment).
Example: The Ice Age block (Ice Age-Homelands-Alliances) left this environment when the Tempest card set rotated in to start The Rath Cycle block.
Last edited by Xitax on 16 Mar 2012, 02:29, edited 3 times in total.
Re: Help - Card set assignment constructed decks.
by friarsol » 12 Mar 2012, 16:19
It looks like you are having problems finding it due to naming. When "Standard" was first invented, it was called "Type 2"
http://forums.mtgsalvation.com/showpost ... stcount=19
http://forums.mtgsalvation.com/showpost ... stcount=19
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Help - Card set assignment constructed decks.
by Xitax » 13 Mar 2012, 02:00
Wow! That is quite helpful! I spent hours poring over decklists trying to figure out what was standard at a particular time... 
Now I have:

Now I have:
- Code: Select all
Standard DKA ISD M12 NPH MBS SOM
Standard ISD M12 NPH MBS SOM
Standard M12 NPH MBS SOM M11 ROE WWK ZEN
Standard NPH MBS SOM M11 ROE WWK ZEN
Standard MBS SOM M11 ROE WWK ZEN
Standard SOM M11 ROE WWK ZEN
Standard M11 ROE WWK ZEN M10 ARB CON ALA
Standard ROE WWK ZEN M10 ARB CON ALA
Standard WWK ZEN M10 ARB CON ALA
Standard ZEN M10 ARB CON ALA
Standard M10 ARB CON ALA EVE SHM MOR LRW
Standard ARB CON ALA EVE SHM MOR LRW 10E
Standard CON ALA EVE SHM MOR LRW 10E
Standard ALA EVE SHM MOR LRW 10E
Standard EVE SHM MOR LRW 10E PLC FUT TSP TSB
Standard SHM MOR LRW 10E PLC FUT TSP TSB CSP
Standard MOR LRW 10E PLC FUT TSP TSB CSP
Standard LRW 10E PLC FUT TSP TSB CSP
Standard 10E PLC FUT TSP TSB CSP DIS GPT RAV
Standard FUT PLC TSP TSB CSP DIS GPT RAV 9ED
Standard PLC TSP TSB CSP DIS GPT RAV 9ED
Standard TSP TSB CSP DIS GPT RAV 9ED
Standard DIS GPT RAV 9ED SOK BOK CHK
Standard GPT RAV 9ED SOK BOK CHK
Standard RAV 9ED SOK BOK CHK
Standard 9ED SOK BOK CHK 5DN DST MRD
Standard SOK BOK CHK 5DN DST MRD 8ED
Standard BOK CHK 5DN DST MRD 8ED
Standard CHK 5DN DST MRD 8ED
Standard 5DN DST MRD 8ED SCG LGN ONS
Standard DST MRD 8ED SCG LGN ONS
Standard MRD 8ED SCG LGN ONS
Standard 8ED SCG LGN ONS JUD TOR ODY
Standard SCG LGN ONS JUD TOR ODY 7ED
Standard LGN ONS JUD TOR ODY 7ED
Standard ONS JUD TOR ODY 7ED
Standard JUD TOR ODY 7ED APC PLS INV
Standard TOR ODY 7ED APC PLS INV
Standard ODY 7ED APC PLS INV
Standard APC 7ED PLS INV PCY NEM MMQ
Standard 7ED PLS INV PCY NEM MMQ
Standard PLS INV PCY NEM MMQ 6ED
Standard INV PCY NEM MMQ 6ED
Standard PCY NEM MMQ 6ED UDS ULG USG
Standard NEM MMQ 6ED UDS ULG USG
Standard MMQ 6ED UDS ULG USG
Standard 6ED UDS ULG USG EXO STH TMP
Standard 6ED ULG USG EXO STH TMP
Standard ULG USG EXO STH TMP 5ED
Standard USG EXO STH TMP 5ED
Standard EXO STH TMP 5ED WTH VIS MIR
Standard STH TMP 5ED WTH VIS MIR
Standard TMP 5ED WTH VIS MIR
Standard 5ED WTH VIS MIR ALL HML ICE
Standard VIS MIR ALL 4ED
Standard VIS MIR ALL CHR 4ED
Standard 4ED CHR HML ALL MIR
Standard 4ED FEM ICE CHR HML ALL MIR
Standard 4ED FEM ICE CHR HML ALL
Standard 4ED FEM ICE CHR HML
Standard 4ED FEM ICE CHR
Standard 4ED FEM ICE
Standard 4ED DRK FEM ICE
Standard 4ED DRK FEM
Standard 3ED DRK FEM
Re: Help - Card set assignment constructed decks.
by Max mtg » 13 Mar 2012, 06:22
i am not sure standard with early (outside of any cycle) sets make any sense.
My guess on how to assign edition to a cardpool is
1. Find the earliest set when all the cards were already printed ( see res\blockdata\setdata.txt for indexes to compare sets)
2. Assign every card the latest edition which should be equal or earlier than the edition just found.
3. Save
My guess on how to assign edition to a cardpool is
1. Find the earliest set when all the cards were already printed ( see res\blockdata\setdata.txt for indexes to compare sets)
2. Assign every card the latest edition which should be equal or earlier than the edition just found.
3. Save
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: Help - Card set assignment constructed decks.
by friarsol » 13 Mar 2012, 12:22
Yea I agree. The most logical starting place is:Max mtg wrote:i am not sure standard with early (outside of any cycle) sets make any sense.
5ED WTH VIS MIR ALL HML ICE
(Ice Age Block + Mirage Block + 5th Edition)
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Help - Card set assignment constructed decks.
by Xitax » 13 Mar 2012, 17:28
That's a good point. I don't think I have any decks that were that early anyway. I might need to account for decks somewhere in the 4th edition area which is a little earlier a la Shandalar, but I can make up a block with all the early sets in it and just call it good.friarsol wrote:Yea I agree. The most logical starting place is:Max mtg wrote:i am not sure standard with early (outside of any cycle) sets make any sense.
5ED WTH VIS MIR ALL HML ICE
(Ice Age Block + Mirage Block + 5th Edition)
Also, I'm going to optimize by deleting some of them like:
Standard MBS SOM M11 ROE WWK ZEN
Standard SOM M11 ROE WWK ZEN
and keep
Standard NPH MBS SOM M11 ROE WWK ZEN
because no deck from between SOM and MBS will have MBS and NPH therefore unnecessary to spend the extra time to check all 3 standard environments.
The script is coming along pretty well. It should be in shape enough to convert a deck later today.
Re: Help - Card set assignment constructed decks.
by Xitax » 13 Mar 2012, 20:12
Sorry for the double-post.Max mtg wrote:i am not sure standard with early (outside of any cycle) sets make any sense.
My guess on how to assign edition to a cardpool is
1. Find the earliest set when all the cards were already printed ( see res\blockdata\setdata.txt for indexes to compare sets)
2. Assign every card the latest edition which should be equal or earlier than the edition just found.
3. Save
Actually, the more I consider this idea, the better it sounds. It would seem to accomplish the same thing with less work. If I find the oldest set in which all the cards have been printed and it's a Standard deck, the deck builder has already done my work for me and for me to compare sets with standard definitions is redundant. Under this rule all the cards should be assigned sets that fell inside of that window anyway.
Unless somebody can think of how this could fail, I'm going to change tactics and try this method.
Re: Help - Card set assignment constructed decks.
by Xitax » 14 Mar 2012, 01:27
No, there's a major problem with this type of sorting. There are quite a few sets in mtg-data.txt that I can't assign a card to because Forge doesn't support the set, e.g. Master's editions, Beatdown, Duel decks, From the Vault XXXX. For example, if I have a deck who's oldest set where all cards have been printed is ALA and it contains a Shivan Dragon, the algorithm will assign it to FVD. There's nothing in mtg-data.txt that tells me which sets I should not assign. I'd have to filter those manually, and I'm trying to make the script as automated as possible.
Any ideas?
EDIT: For now, I've created a file with the excluded set symbols.
Any ideas?
EDIT: For now, I've created a file with the excluded set symbols.
Re: Help - Card set assignment constructed decks.
by friarsol » 14 Mar 2012, 01:49
Did anyone say anything about mtg-data? Max mentioned using res\blockdata\setdata.txtXitax wrote:No, there's a major problem with this type of sorting. There are quite a few sets in mtg-data.txt that I can't assign a card to because Forge doesn't support the set, e.g. Master's editions, Beatdown, Duel decks, From the Vault XXXX. For example, if I have a deck who's oldest set where all cards have been printed is ALA and it contains a Shivan Dragon, the algorithm will assign it to FVD. There's nothing in mtg-data.txt that tells me which sets I should not assign. I'd have to filter those manually, and I'm trying to make the script as automated as possible.
Any ideas?
EDIT: For now, I've created a file with the excluded set symbols.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Help - Card set assignment constructed decks.
by Xitax » 14 Mar 2012, 03:02
Oh, bugger! That's what I get for not reading clearly.
Well now I have to go and revise a bit of code
, and setdata.txt has the sets in chronological order so I don't have to mess with parsing the dates from mtg-data.txt.
EDIT: OK! It works! I have to do just a couple more things before I can release it. One complaint, though: POR should come after WTH, not before it.
Well now I have to go and revise a bit of code

EDIT: OK! It works! I have to do just a couple more things before I can release it. One complaint, though: POR should come after WTH, not before it.
Re: Help - Card set assignment constructed decks.
by friarsol » 14 Mar 2012, 12:19
You sure about that? According to wikipedia, it was released May 1 1997, where Weatherlight was released June 6, 1997 according to mtgsalvation.Xitax wrote:EDIT: OK! It works! I have to do just a couple more things before I can release it. One complaint, though: POR should come after WTH, not before it.
Edit: Also from mtgsalvation, "Cloud Djinn is a functional reprint of Cloud Dragon from Portal, save for creature type." Implying that Portal came first.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Help - Card set assignment constructed decks.
by Xitax » 15 Mar 2012, 00:05
Weatherlight was June 6th, 1997 by almost every source I can find. However, every site I could find listed Portal as "June 2007," even on Wizards' website. The May 1st date for Portal probably comes from here, https://www.wizards.com/magic/generic/c ... Portal.txt, but it's not clear whether that date is just the spoiler release date, especially since it's listed as June everywhere else. Oh well - it's a pointless academic argument, so I'll move on to better things.friarsol wrote:You sure about that? According to wikipedia, it was released May 1 1997, where Weatherlight was released June 6, 1997 according to mtgsalvation.Xitax wrote:EDIT: OK! It works! I have to do just a couple more things before I can release it. One complaint, though: POR should come after WTH, not before it.
Edit: Also from mtgsalvation, "Cloud Djinn is a functional reprint of Cloud Dragon from Portal, save for creature type." Implying that Portal came first.
I find the argument that Cloud Djinn is a reprint of Cloud Dragon when both sets were released at most a month apart a little daft, though...

Re: Help - Card set assignment constructed decks.
by Xitax » 15 Mar 2012, 00:36
I have a request regarding mtg-data.txt. It will help greatly if CFX instead of CON is used as well as MBP vs. PRO and PO2 vs P02. EVT is now both Eventide and Duel Decks: Elspeth vs. Tezzeret.
The more agreement between these two and my job gets easier. For the meantime I'll load the alternate set codes as well.
The more agreement between these two and my job gets easier. For the meantime I'll load the alternate set codes as well.
Re: Help - Card set assignment constructed decks.
by friarsol » 15 Mar 2012, 01:18
Are you asking about the file mtg-data? That's generated by Arch, not by us. We just use it. viewtopic.php?f=27&t=1347Xitax wrote:I have a request regarding mtg-data.txt. It will help greatly if CFX instead of CON is used as well as MBP vs. PRO and PO2 vs P02. EVT is now both Eventide and Duel Decks: Elspeth vs. Tezzeret.
The more agreement between these two and my job gets easier. For the meantime I'll load the alternate set codes as well.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Deck set assignment deck converter released!
by Xitax » 15 Mar 2012, 05:01
OK! I'm ready to share my deck set converter!
Here it is: link removed - see last post for most recent version.
What it is:
Tired of playing with the same lands or CARDNAME from the same set every time? This program will take any deck file or many deck files at once and assign set values to each card in the deck based on finding the earliest expansion when all the cards in the deck were in print and assigning each card to the newest set that was available at that time. It will also prefer not to assign Portal or Starter sets unless there is no other set available in print at that time either.
What to do:
I suggest placing decksetfix.exe in its own folder someplace safe.
You will need to copy mtg-data.txt from /res and blockdata.txt from /res/blockdata to the folder along with the executable.
To use the program, copy any deck files you wish to convert into the same folder with decksetfix.exe.
Run the program! You may choose to convert a deck at a time, or to convert them all at once. The output files will be written to /output.
Any comments, bugs, or questions are welcome!
EDIT: Just converted 2492 constructed decks (thanks, gos!) with only 3 errors: the program doesn't like cards listed more than once - not sure I should really fix this - and it won't convert decks with filenames that begin with a period.
The offending decks were Rot from Within (forest listed 4x), War of Attrition (Plains listed 4x, and some extra forests not supposed to be in the event deck anyway
), and ...And the infinite sadness (leading periods) - might try to fix.
EDIT 2: More bugs. Hold the phone.
EDIT 3: The confusion between EVT and EVE for Eventide is causing problems. I would like to suggest the removal of Alias EVT from setdata.txt as mtg-data.txt also uses EVE for Eventide and EVT for Elspeth vs. Tezzeret.
Here it is: link removed - see last post for most recent version.
What it is:
Tired of playing with the same lands or CARDNAME from the same set every time? This program will take any deck file or many deck files at once and assign set values to each card in the deck based on finding the earliest expansion when all the cards in the deck were in print and assigning each card to the newest set that was available at that time. It will also prefer not to assign Portal or Starter sets unless there is no other set available in print at that time either.
What to do:
I suggest placing decksetfix.exe in its own folder someplace safe.
You will need to copy mtg-data.txt from /res and blockdata.txt from /res/blockdata to the folder along with the executable.
To use the program, copy any deck files you wish to convert into the same folder with decksetfix.exe.
Run the program! You may choose to convert a deck at a time, or to convert them all at once. The output files will be written to /output.
Any comments, bugs, or questions are welcome!
EDIT: Just converted 2492 constructed decks (thanks, gos!) with only 3 errors: the program doesn't like cards listed more than once - not sure I should really fix this - and it won't convert decks with filenames that begin with a period.
The offending decks were Rot from Within (forest listed 4x), War of Attrition (Plains listed 4x, and some extra forests not supposed to be in the event deck anyway

EDIT 2: More bugs. Hold the phone.
EDIT 3: The confusion between EVT and EVE for Eventide is causing problems. I would like to suggest the removal of Alias EVT from setdata.txt as mtg-data.txt also uses EVE for Eventide and EVT for Elspeth vs. Tezzeret.
Last edited by Xitax on 16 Mar 2012, 06:01, edited 1 time in total.
60 posts
• Page 1 of 4 • 1, 2, 3, 4
Who is online
Users browsing this forum: No registered users and 16 guests