Archive for the 'Games' Category
The comprehensive rules for Magic: The Gathering say (amongst many other things) this:
101.1. Whenever a card’s text directly contradicts these rules, the card takes precedence. The card overrides only the rule that applies to that specific situation. The only exception is that a player can concede the game at any time (see rule 104.3a).
Okay, fair enough, the exception means that they can’t publish a card with the effect
Target player can’t concede this game.
That makes sense. In fact there are tournament situations where you’d rather concede than let an ability resolve that would give away information about your deck – for example, you’re losing the first game of a three-game match, your opponent has just cast Extirpate, and the key piece of your deck hasn’t come out yet. You’d probably rather concede than let your opponent know what to sideboard against.
And in a broader sense, I’m not sure what it would mean for the rules of a game to say that you’re not allowed to just stand up and walk away.
But… but but but… the rule doesn’t say that a card can’t override rule 101.1 itself. So they could print a card that says
This card can override a player’s right to concede the game at any time.
Target player can’t concede this game.
It just has to override rule 101.1 before it overrides rule 104.3a.
I didn’t say they would print it.4 comments
From a discussion in our Magic group…
You can think of a tournament as a sorting algorithm for ordering the players by skill, where each match is a comparison.
There are a couple of differences:
- Many tournaments only determine a partial ordering – for example, if it’s only looking for a winner.
- Comparisons between two players aren’t guaranteed to be consistent. One player could beat another in one match and lose to the same player in another match; or you could have a scissors-paper-rock type of cycle between three or more players.
For current purposes, we can ignore the first difference and only talk about tournaments where the goal is to rank all the players.
The second point is more interesting. A sorting algorithm assumes that there’s a complete order over the elements, which there isn’t in this case. We could either make it somehow resilient to noise, or find some way to break cycles, all of which is complicated. Or we could let the algorithm do whatever comparisons it does, and if it happens to be inconsistent with previous results then hopefully it’ll be resilient to it somehow. (In the worst case, a dumb-ass algorithm like a naive bubble sort might not terminate.)
Or – and this is why I’ve been thinking about it since this afternoon – we could only make comparisons for which we can’t already infer an answer.
This has some advantages. It means that we can never reach a contradiction where one player beat another but ended up ranked lower than them. It puts a natural limit on the length of the tournament, because the more matches you play, the more potential match-ups become redundant, until there are none left. It might mean that a player can get an unusually low ranking from a bad match-up early on, but that will tend to happen in a scissors-paper-rock sort of situation where no ranking is going to be consistent anyway, so one solution will be as good as any.
So, some solutions that came to mind…
A quicksort tournament would start by choosing one person as the pivot. Everyone plays a match against that person. Then the other players split off into two pools – those who beat the person, and those who didn’t. (Let’s assume there are no draws.) Each of those pools chooses another pivot and repeats until everyone is either a pivot or in a pool by themselves.
There’s an obvious downside to this in, for example, Friday night Magic – the first pivot has to play at least two matches (if those two players either both win or both lose) before anyone else can do anything. Another downside is that there’s a lot of variation in how many matches each person plays – the first pivot plays n-1 matches, but someone else could potentially only play one match (if they’re the only one who beats or is beaten by the first pivot).
(Actually this isn’t necessarily a bad thing for our Magic tournaments – the conversation started with someone pointing out that we have different amounts of free time to play with – but it would be nice the variation wasn’t too big. It would be even nicer if you could direct the extra matches towards people with more time to play.)
A merge sort tournament would avoid some of the first problem – players would pair off at the start of the night, and bottlenecks only start happening at the end of the first round. It still has the varying number of matches problem though. So our ideal sorting algorithm for a tournament would:
- be able to do lots of comparisons in parallel,
- do about the same number of comparisons on each element, and
- not compare elements if it could infer their order.
The first and third constraints are tricky once it gets going – you can’t have multiple matches running in parallel that could potentially give contradictory results. One approach for small numbers of players might be to brute-force it – keep a directed graph of players and schedule matches for which (a) there currently isn’t a path in either direction and (b) there won’t be a path in either direction for any of combination of outcomes of the games currently running. I actually started coding this when I got home, but was quickly distracted by something less confusing.
I gotta break out my Knuth vol. 2…1 comment
Just got home from our first Zendikar draft, which I have, apparently, won – Mr Coker can reach equal first on points (we’ve lost one game each, but he has a game left to play against Mr Karlov), but I’ll have a higher countback. So woo yeah! Go team awesome! (That’s me. I’m team awesome. No you can’t join.)
My card pool looked like this:
|Journey to Nowhere
Gatekeeper of Malakir
Khalni Heart Expedition
Vines of Vastwood
|Khalni Heart Expedition
Shepherd of the Lost
And my deck looked like this (plus, um… 12 Forests and 5 Plains):
(We use numbered sleeves so that we can reconstruct, analyze the bejeezus out of, and ultimately reverse the draft and give everyone back the cards they opened. Yes, we are that obsessed.)
Obviously there’s an Allies thing happening, plus a touch of landfall supported by the Khalni Heart Expeditions and the Frontier Guide. Removal consists of the first-pick Journey to Nowhere and not much else, so it’s definitely a deck that needs to stay on the front foot.
Fortunately it did, against everyone except Mr Shellshear, sporting a black-red deck without much synergy but with plenty of individual bombs, who beat me senseless with a huge creature with Fear Intimidate.
MVPs were Baloth Woodcrasher (can win on its own with multiple landfalls), Turntimber Ranger, and the pair of of Oran-Rief Survivalists. Play of the night was springing Summoning Trap into Turntimber Ranger against DMM who was playing a mono-blue deck built around Lullmage Mentor. (We were speaking in bad French accents at the time, which made it even more awesome. Don’t ask why.) Vines of Vastwood is very versatile as a combat trick and/or finisher, as you’d expect. Shepherd of the Lost seems good but the only time I got it out it didn’t do much (I was already on the back foot against Mr Shellshear).
My first impressions of Zendikar are definitely encouraging me to go back for second and third impressions.2 comments
For a while now I’ve had my own manual sorting algorithm that I use for, for example, sorting cards.
Actually the thing I most often end up sorting is card sleeves. Our Magic drafting group, being a highly distilled collection of nerds, draft into sleeves that are marked with the pack (A-C) and pick order (1-15), so that we can reconstruct and analyse the draft afterwards. So at some point before every draft I need to un-sleeve the previous draft, then sort the sleeves from A1 to C15.
Now… there’s a whole branch of computer science devoted to sorting algorithms (and by “branch” I mean “volume of the Knuth books”), but I’ve never come across any kind of systematic advice for sorting manually, i.e. without the convenience of having a computer instead of a brain and a bunch of digital artifacts instead of some physical pieces of plastic or cardboard. Most people just tend to sort in an ad-hoc way that vaguely resembles an insertion or selection sort. Occasionally I’ve seen someone attempt a radix sort with playing cards (into numbers, then into suits). If you watch this lecture you’ll see someone try to do a bubble sort with a bag over his head.
My manual sorting algorithm isn’t, as far as I know, a well-known programmatic sorting algorithm. You probably wouldn’t want it to be. It involves a variable number of variable-length lists, and doesn’t perform obviously better than a whole class of O(n2) algorithms that are in-place and much easier to implement. But it has the advantage that, for input that’s approximately O(a deck of cards), its space complexity is roughly O(a small area on my desk).
Here’s the algorithm. It’s in two passes.
- Take a card from the deck. Look for a pile on the table (initially there are none) whose top card is lower than the card you’re holding. Put the card on face-up top of that pile. If there’s no such pile, put the card in a new pile. Repeat until the deck is empty.
- Find the highest card among the top cards of the piles on the table. Move that card to the deck. Repeat until there are no piles left.
That’s a pretty sparse explanation. I might take a shot at making a video with actual cards – not that I expect it to be very useful, but it would also serve the purpose of playing with the 5D Mk II’s video mode.
One interesting thing is that the algorithm sort of takes advantage of the fact that a human can pick one from a handful of cards or piles at a glance in roughly constant time – or, at least, it doesn’t quite feel like a linear search because you quickly pick up ad-hoc shortcuts to find the right pile. (Also, the overhead of physically moving the cards around, which you can’t get away from using any technique, outweights the time it takes you to find the right pile.)
Even if you do end up doing a linear search for the right pile, the time complexity isn’t too bad. Worst case is quadratic, where the cards start in reverse order and each card ends up in its own pile. Best case is linear, where the cards start in order and all the cards go in one pile. The expected complexity for shuffled cards is… I dunno, I haven’t worked it out. The important factor is the average number of piles you end up with, which is complicated. I’d guess it works out to something like √n, which would make the whole thing O(n3/2), maybe. You could look at it as a selection sort with a probabilistic speedup for the “selection” bit.
Anyway, that’s how I’ve been sorting card sleeves for a while. I hope someone found that interesting. And if this is acutally a well-known algorithm, let me know what it’s called. (Haven’t really looked for it myself yet. My Knuth books are at work at the moment, so I might check there on Monday.)No comments
Mr Shellshear pointed out to me last night that the record of our M10 draft had the seating arrangement in the wrong order. So the auto-drafted results in my last post were still interesting, but didn’t necessarily boil down to actual packs with the right rarity distribution and whatnot.
The results with the correct seating order are below the fold. I also turned up the bias towards already-drafted cards. I still wouldn’t call the behaviour sensible, but I wouldn’t be totally upset with the pool it drafted. (In particular, I made good use of Whispersilk Cloak on the night, especially alongside an Enormous Baloth. And I seem to have picked up a Protean Hydra somehow.)No comments
This is kind of cool.
I’ve had an idea for a while to make an automatic draft picker for Magic: the Gathering. The idea was to use a sort of naive Bayes approach, using the records of previous drafts to estimate:
- the probability that a player, given a pack with cards A and B, will pick A over B;
- the probability that a player, given a pack with card A and having already drafted card B, will pick A over the other cards in the pack.
The idea is that the former gives an estimate of card quality, and the latter estimates the influence of earlier picks on each card. To use this in a draft, you (that is to say, the program that’s doing it for you) just multiply all the probabilities together for each card, and pick the one with the highest score.
So I finished coding it up this morning. Then I trained it using four Magic 2010 drafts from the MtG website (e.g. this one), then re-ran our draft from a couple of weeks ago, to see what would have happened if we were all replaced by auto-drafters.
The results are below the fold. And it’s not completely ridiculous. It’s probably less focused in colours than it could be; maybe there’s some tweaking to be done by weighting the influence of previous picks. But at a glance, I can’t see anyone’s card pool that couldn’t be made into, say, a two-colour deck with a third splash. (Edit: Now that I think about it, this is probably true of any 45 random cards. Hmm. Well, most of the pools have a strong leaning towards two or at most three colours, and Andrew C could almost get away with mono-green.)
Bizarrely, it’s drafted a red-blue deck for me instead of the white-green deck I actually played (although I did feel bad about not using that first-pick Lightning Bolt in the second pack).
There are a few hiccups because the training set of four drafts wasn’t big enough – there’s no way Ajani should have gone fifth pick, for example. I’m optimistic that throwing more data at it would make it better. In an ideal world, I’d somehow get hold of the results of every Magic Online draft to pump through it, and it would represent the collective wisdom of every online player everywhere.
In fact, if anyone from Wizards would like to do this, let me know.
Actually, that’s not as silly as it sounds. (Well, letting me do it probably is.) There’s already an AI of some kind controlling the online draft simulator. That could be something similar to my system, or it could just be a hand-crafted pick order along with some kind of futzing to get it to pick roughly consistent colours. It’d be interesting to find out how it works. (But they’ll never tell us.)
Interestingly, some kind of auto-picker could be useful for Magic Online. If you don’t pick a card within the time limit in an online draft, it randomly picks one for you. (At least, it was random last time I checked. I haven’t drafted online for a while.) MO has recurring problems with lag and dropped connections, so it would make a lot of people very happy to have an auto-drafter that makes vaguely intelligent choices when they can’t do it themselves.
Now, it can’t be too good, or you could start relying on it to do the draft for you. This could be a showstopper, since the outcome of a draft is supposed to depend on the players’ skill. (In fact, there’s a good chance that someone in Wizards has already had this conversation.) But maybe an auto-drafter that’s not a genius, but knows not to take the basic land and will generally pick playable cards in your colours, would be just enough of a safety net that people wouldn’t be driven to mass killings when their connection drops. Maybe.
I might put the code up later (after I do a cleanup and/or rewrite – it’s pretty ugly right now). Meanwhile, keep reading for the results of the re-draft.
Edit 2: I tried doubling, then quadrupling the effect of the already-drafted cards on the next pick. This puts nearly everyone solidly into two colours. (Unfortunately it leaves Mr Shellshear with an impressive blue-white deck, and anyone who remembers our first Lorwyn draft will realise what a bad idea that is. Apparently some people do just open all the good cards.) I’d post the new results, but I’m wary of picking at this too much, and would rather just leave the original results as they are until I get around to cleaning up the code.No comments
In last night this morning’s post I talked a bit about how I missed Magic: the Gathering’s ability to support mono-colour decks during the recent tri-colour-focused Alara block. So now I’m going to jot down some thoughts about how a Magic expansion could revisit a multi-colour theme (which it probably will) without giving up the reward for focusing on one colour.
The high concept is a plane that’s struggling against segregation based on mana colour alignment. (There’s an obvious political/moral statement in here that Wizards would probably be well-advised to avoid.) The inhabitants of the plane have, for most of their history, kept separate communities that are very strongly aligned with one colour. However, in more recent times a growing number of radicals have started coming together as a “mixed” faction that blends all five colours.
Naturally, there’s tension between these groups. The new faction sees this as an opportunity to combine the best of each of the colours, compensate for the weakness of each, and create something new that’s better than the sum of its parts. The traditional, segregated communities (most of which consider their own colour to be self-evidently superior to the others) see this multi-colour business as heresy, a watering-down of the pure, separate sources of mana that are at the foundation of magic. Paradoxically, there’s a kind of uneasy consensus among the mono-colourists that the new threat is a bigger problem than their existing diffences; they’re not going to actively cooperate with each other, but they might develop attacks that are more effective against “mixed” heretics than against each other (example).
Mechanically, the cards (not all of them, necessarily – there could be some non-aligned cards, like in Ravnica block) would fall into two categories. Mono-colour cards would reward a heavy investment in that colour, with abilities like Chroma and heavily coloured costs like Overrun. Multicolour cards would reward colour diversity, revisiting Domain and WUBRG cards (Mark Rosewater said recently that he would have taken the five-colour theme out of Conflux in hindsight, so they could plausibly take another swing at it), and other shenanigans like Sunburst. Mana fixing and multilands would mostly fall in the latter category – something like the Ravnica block bouncelands that makes multi-colour costs easier to pay while making it hard to generate lots of the same colour.
The optimal decks – for constructed play, at least – should be (a) mono-colour and (b) five-colour. Ideally, both (technically, all six) of these archetypes should be feasible in draft as well. (I’m not sure how this would work for sealed.) Drafting a mono-colour deck with no splash would probably be a lofty goal rather than something you achieve in most drafts, but there should be cards that reward you the closer you get to it. (Quick idea: an undercosted mono creature with “whenever you play a non-[this creature's colour] spell, sacrifice [this]“.)
Anyway, that’s the idea. Thoughts? Job offers from WotC?No comments