It is currently 11 Dec 2018, 20:10
   
Text Size

Method to order mana symbols in the mana cost

General Discussion of the Intricacies

Moderator: CCGHQ Admins

Method to order mana symbols in the mana cost

Postby melvin » 29 Jun 2012, 06:02

I added automatic ordering of mana symbols in Magarena recently. It took me a while to figure out a clean way to do it and I was wondering if there is an even simpler method.

The official ruling for mana symbol ordering from https://www.wizards.com/magic/magazine/ ... zards/0604
Del Laugel, Magic technical editor wrote:Our current (and final!) system for ordering mana symbols is pretty simple. If you look at the back of a Magic card, you'll see the pentagon of colors. Going clockwise, the colors are white, blue, black, red, green, white, blue, black . . . . To order a pair of mana symbols, find them in that list, and then put them in whichever order puts the fewest colors between them. For example, white/red has two colors in the middle (blue and black), but red/white has only one (green). That's why Goblin Legionnaire's mana cost is {R} {W}.

Then came the Apocalypse 'wedge' cards. Our system breaks down when you're trying to order two friendly colors and their common enemy, and Apocalypse has five rares with mana costs that fall into that category. For Lightning Angel's mana cost, {1} {R} {W} {U} and {1} {W} {U} {R} are equally valid options. In the end, I decided to put the enemy color pair first.
However it doesn't mention the hybrid mana and other oddities. Turns out that in existing cards, only the 2 color hybrid mana interacts with the mono color and they are always drawn first. The image below shows the order of mana symbols in the current cards, there is an arrow from A to B if A can appear immediately before B.

mana_cost_graph.png
Ordering of mana symbols


Hence, the ordering is {X}, following by colorless mana, followed by hybrid mana, followed by mono color. Within the mono colors, the above "pretty simple" system needs to be followed.

The way I do it is as follows. Find the first color in the order, then follow the WUBRG cycle to add the other colors. WUBRG is the ordering when all five mono colors are present. Let prev(color) be the previous color according to WUBRG and prev(W) = G.

let C the casting cost limited to just the mono color mana symbols. To find the first color, let F be the colors in C where the previous color is NOT in C, i.e F = {c in C, where prev(c) not in C}, i.e.

F has either 0, 1, or 2 colors.

If |F| = 0, the only case is when all five colors are present, hence the first color is W.

If |F| = 1, this happens when the colors form a "chain", then the first color is the color in F.

If |F| = 2, let the two colors in F be p and q. This is the wedge/enemy color case.
If prev(prev(p)) = q, the first color is q,
else the first color is p

Question: Is there a simpler method for this "pretty simple" system?
User avatar
melvin
AI Programmer
 
Posts: 1043
Joined: 21 Mar 2010, 12:26
Location: Singapore
Has thanked: 36 times
Been thanked: 452 times

Re: Method to order mana symbols in the mana cost

Postby MageKing17 » 29 Jun 2012, 08:42

melvin wrote:Question: Is there a simpler method for this "pretty simple" system?
Answer: Not that I've found; you seem to have hit it right on the head. I've thought about having Incantus's hybrid mana selection code output choices using this ordering scheme (right now it's pure WUBRG ordering), but I can't be arsed to actually spend the time adding the code to make it sort this way. :P
User avatar
MageKing17
Programmer
 
Posts: 473
Joined: 12 Jun 2008, 20:40
Has thanked: 5 times
Been thanked: 9 times

Re: Method to order mana symbols in the mana cost

Postby Marek14 » 30 Jun 2012, 06:49

I suspect that the hybrid rule is not "hybrid first", but "hybrid symbols are sorted by their first color". All cards that mix hybrid and normal have their normal color a central color of a shard, and the hybrid two other colors of the shard. That makes the first color of hybrid a color that preceds the central color, and that's why it's sorted first.
Marek14
Tester
 
Posts: 2636
Joined: 07 Jun 2008, 07:54
Has thanked: 0 time
Been thanked: 257 times

Re: Method to order mana symbols in the mana cost

Postby MageKing17 » 30 Jun 2012, 17:23

Marek14 wrote:I suspect that the hybrid rule is not "hybrid first", but "hybrid symbols are sorted by their first color". All cards that mix hybrid and normal have their normal color a central color of a shard, and the hybrid two other colors of the shard. That makes the first color of hybrid a color that preceds the central color, and that's why it's sorted first.
I don't suppose there's an easy way to ask gatherer for all cards with hybrid and non-hybrid colored mana symbols, is there? This sounds perfectly reasonable, but I can't think of an easy way to confirm it without having to wade through loads of irrelevant cards.
User avatar
MageKing17
Programmer
 
Posts: 473
Joined: 12 Jun 2008, 20:40
Has thanked: 5 times
Been thanked: 9 times

Re: Method to order mana symbols in the mana cost

Postby silly freak » 30 Jun 2012, 17:29

My feeling tells me No. it should feel natural, and although I'm familiar with the color wheel, many people may not know how the colors are ordered. for them, having both {Color}{Hybrid} and {H}{C}, or even {H}{C}{H} or {C}{H}{C}, would seem awkward. and even though I know, I think it would still look strange to me...
___

where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
silly freak
DEVELOPER
 
Posts: 598
Joined: 26 Mar 2009, 07:18
Location: Vienna, Austria
Has thanked: 93 times
Been thanked: 25 times

Re: Method to order mana symbols in the mana cost

Postby MageKing17 » 30 Jun 2012, 18:06

silly freak wrote:My feeling tells me No. it should feel natural, and although I'm familiar with the color wheel, many people may not know how the colors are ordered. for them, having both {Color}{Hybrid} and {H}{C}, or even {H}{C}{H} or {C}{H}{C}, would seem awkward. and even though I know, I think it would still look strange to me...
The real question is whether {GW} {R} looks more natural than {R} {GW} when even people without a full understanding of the color wheel have probably seen more than a few {R} {G} {W} cards.

(Before you ask, I checked, and there are no cards with a mana cost of {GW} {R} or {R} {GW}.)
User avatar
MageKing17
Programmer
 
Posts: 473
Joined: 12 Jun 2008, 20:40
Has thanked: 5 times
Been thanked: 9 times

Re: Method to order mana symbols in the mana cost

Postby silly freak » 30 Jun 2012, 19:29

The point is, they have made a precedent. It's weird when {H}{C} *and* {C}{H} exists, not when {C}{H} exists *instead of* {H}{C}. I think that in a vacuum, {R} {GW} looks better, but in practice I would be confused because I already know {H}{C}.
___

where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
silly freak
DEVELOPER
 
Posts: 598
Joined: 26 Mar 2009, 07:18
Location: Vienna, Austria
Has thanked: 93 times
Been thanked: 25 times

Re: Method to order mana symbols in the mana cost

Postby MageKing17 » 30 Jun 2012, 19:53

silly freak wrote:The point is, they have made a precedent.
I think we're agreed on that... the only question is what that precedent is. ;)

silly freak wrote:It's weird when {H}{C} *and* {C}{H} exists, not when {C}{H} exists *instead of* {H}{C}. I think that in a vacuum, {R} {GW} looks better, but in practice I would be confused because I already know {H}{C}.
I don't see how having some cards be "{H}{C}" and some cards be "{C}{H}" is confusing... but then, I don't understand how people can be confused by things like the stack, yet such people obviously exist (and in surprisingly large numbers).
User avatar
MageKing17
Programmer
 
Posts: 473
Joined: 12 Jun 2008, 20:40
Has thanked: 5 times
Been thanked: 9 times

Re: Method to order mana symbols in the mana cost

Postby silly freak » 30 Jun 2012, 21:34

MageKing17 wrote:
silly freak wrote:The point is, they have made a precedent.
I think we're agreed on that... the only question is what that precedent is. ;)

...

I don't see how having some cards be "{H}{C}" and some cards be "{C}{H}" is confusing...
Okay, we're getting a bit off-topic... but let me give a last response: my train of thought was that "kind of mana symbol matters" is easier to grasp than "first color part of hybrid mana symbol matters", even for someone who is accustomed to monocolor symbol ordering (me being an example). Someone who doesn't is even more obvious.
Now, given Wizards will probably not want to confuse the majority of players, they will stick with the "simpler" route, even if their precedent doesn't rule any of our logic out. The point is, even if they intended to do first-color-based ordering, they effectively installed in most people's minds that hybrid goes before mono, and that public opinion, not their intent, is what would IMO settle the decision on how to print the first card where the two strategies would conflict.

Of course, all that relies on me thinking that my own opinion is "esier to get" than yours, a point we can't really settle using arguments...
___

where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
silly freak
DEVELOPER
 
Posts: 598
Joined: 26 Mar 2009, 07:18
Location: Vienna, Austria
Has thanked: 93 times
Been thanked: 25 times

Re: Method to order mana symbols in the mana cost

Postby melvin » 01 Jul 2012, 02:03

MageKing17 wrote:I don't suppose there's an easy way to ask gatherer for all cards with hybrid and non-hybrid colored mana symbols, is there? This sounds perfectly reasonable, but I can't think of an easy way to confirm it without having to wade through loads of irrelevant cards.
The image in my post is generated from all mana costs found in Arch's latest mtg data from gatherer (I removed {X} and colorless before drawing the graph to keep it readable) and it confirms Marek14's observation. Current cards that mix hybrid and mono mana symbol are all of the form {prev(c)/next(c)}{c}. So there is no data to disprove Marek14's hypothesis.

My own hypothesis is that mana symbols are first ordered by flexibility. So hybrid should always be before mono.
User avatar
melvin
AI Programmer
 
Posts: 1043
Joined: 21 Mar 2010, 12:26
Location: Singapore
Has thanked: 36 times
Been thanked: 452 times

Re: Method to order mana symbols in the mana cost

Postby Marek14 » 01 Jul 2012, 07:08

melvin: Of course there's no data -- all cards of this form were in Alara Reborn and they all confirm to their respective shards.

You're probably right with your "flexibility" ordering, but just as with question "would Phyrexian mana symbols go before or after normal mana symbols?" or "Where does snow mana symbol go?", there's no actual answer until Wizards actually print a card with such combination of mana symbols.
Marek14
Tester
 
Posts: 2636
Joined: 07 Jun 2008, 07:54
Has thanked: 0 time
Been thanked: 257 times

Re: Method to order mana symbols in the mana cost

Postby melvin » 01 Jul 2012, 07:38

Marek14 wrote:Of course there's no data -- all cards of this form were in Alara Reborn and they all confirm to their respective shards.
Thanks, that explains why only that particular pattern have been printed. I had not looked up the actual cards as it was somewhat tricky to do with my current analysis scripts.

Del Laugel, Magic technical editor wrote:For Lightning Angel's mana cost, {1} {R} {W} {U} and {1} {W} {U} {R} are equally valid options. In the end, I decided to put the enemy color pair first.
On another note, the seemingly arbitrary choice by Del Laugel to put enemy color pair first in wedge cards simplifies my method. The last case (|F| = 2) handles both cases of two enemy colors (e.g. {R} {W}) and wedge colors (e.g. {R} {W} {U}). If the allied colors have to go first, then |F| = 2 need to distinguish between two colors and three colors.
User avatar
melvin
AI Programmer
 
Posts: 1043
Joined: 21 Mar 2010, 12:26
Location: Singapore
Has thanked: 36 times
Been thanked: 452 times

Re: Method to order mana symbols in the mana cost

Postby vesuvanduquesne » 29 Dec 2013, 20:49

I wrote my own for my application as well. In the database, I keep track of the printed casting cost, and then I 'correct' the order of the mana colors in it to conform to the WUBRG format. So if anyone is looking up a red/white multicolored card, if they select 'WR', then all cards in the database with the 'corrected' mana WR will appear in her results, regardless of whether it is printed as WR or RW.

The regular expression to separate them out isn't pretty.
vesuvanduquesne
 
Posts: 33
Joined: 06 Oct 2008, 16:26
Has thanked: 67 times
Been thanked: 2 times


Return to Magic Rules Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest


Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 10 minutes)
Most users ever online was 279 on 11 Jul 2013, 22:03

Users browsing this forum: No registered users and 1 guest

Login Form