How would you program an AI to play Magic the Gathering?

Started by
10 comments, last by Premandrake 19 years, 9 months ago
True ... but in a best of three games it may lose the first hands down, but then the possibility of cards is reduced to app 10 - 20 cards + land assuming the players follow normal deck building conventions. Also it should fully know what is in it's deck (just not where) so the probabilities are far less. Then for the first game all the cards are in a large probability tree (sorted by color, type, casting cost, other subdivisions) which is then pruned by guesses. Like I said though it'll probably lose the first game.
And if there is only one game for each and you don't change your deck the other agents can benefit off the previous agent's knowledges
God bless-Gryfang
Advertisement
Another thing to consider is that they just may have cheated. It's hard enough to play the game when you don't know what the opponent has, and what your next cards are. If you knew your deck structure it would be easier to plan your actions.

One thing I do know is they had a hell of a time getting a good way of representing all the cards and rules into the game. I recall it was delayed a year or two because they were having so many problems with it.

If I were to take a first shot at it though, I'd probably go about representing each card as something within a group. So you'd have your lands, creatures, player affecting sorcery, creature affecting sorcery, card affecting interrupt, etc.

Then I'd probably have a whole bunch of rules for evaluating which cards are "good" to play. Sure, it's not amazing, but it could probably end up playing well if you knew what the opponent has (and was going to have in the future). So for each card that had some action attached to it, I'd see if that action was possible, and pick the best possible action, then keep doing that until I have no actions left (or decide it would be better to save some mana).

A little example might be if you have a creature available for attacking, a fireball and creature in your hand and 5 untapped mana. So you look at the creature and say, this guy can attack, but if he attacks I look at what I will have left defending me, and what the opponent will be able to attack me with. If he can knock off more than 5 life or so, I leave my creature untapped. Otherwise it's off to the races. And similarly, I look at my cards in my hand.

Now that I think about it a bit more, you might have to do a search of the possibilities for your own play (not even considering the opponent). But knowing your upcoming cards would help out here.

This topic is closed to new replies.

Advertisement