Monday, August 31, 2009

The Computer Doesn't Mulligan and Why It Doesn't Matter - Part 2

Basically the "Stack AI Land" option gives the AI a 5-10% improvement although this is just a guess. You can use this option to make the computer a little harder or easier. If I am playing MTG Forge's quest mode and the computer's decks are too easy I turn this option on and if I am losing more often, I turn it off. You can also do the same thing for sealed and draft.

Specifically the "Stack AI Land" option gives the computer 7 spells and 1 land. The computer then draws lands for the next 3 turns, then a spell, and then 3 more lands (I think). This improves the AI because it gives the computer 7 spells to choose from for the first couple of turns. A future improvement could stack the computer's deck with an optimal mana curve so the AI would always have something to play for each turn.

p.s. When the computer has to discard a card, I coded the AI to just discard a card at random. While this solution isn't perfect, it works "good enough".


Rob Cashwalker said...

I don't like the idea of stacking the mana curve.

I added an intelligent discard method while coding the spDraw mechanic. It will discard a land card if it has more than 5 lands in play; or if less than 5 lands and no lands in hand, it will discard the most expensive spell in hand; or if more than 5 lands, but no lands in hand it will discard the cheapest card in hand. There are probably better choices for discard that could be made, but this is at least better than random.

Forge said...

Better than random is very good and sometimes very hard to code :)

Shing said...

I always leave "Stack AI Land" option on but sometimes the AI won't play a land on the first turn. Is that a bug or is it intentional?

nantuko84 said...

I've just found out that there is still old source code in svn on your google code project page I've uploaded on Aug 2008 ;) I believe it should be deleted from there (sorry, seems I can't do that by myself as now I have no access rights to the svn)

Forge said...

"I always leave "Stack AI Land" option on but sometimes the AI won't play a land on the first turn. Is that a bug or is it intentional?"

Bug. I've even seen the AI not play a land AND discard a land on its first time. I have no idea why this happens other than it is a bug concerning MTG Forge's very buggy "phase code." Just progressing to the next phase is more complicated than even I could imagine.