Monday, July 6, 2009

AI Attacking

Combat is at the very center of Magic. Knowing when to attack and block is crucial to every game. Trying to program the AI to intelligently attack and block is very complicated. I have already rewritten the AI combat code once and I spent a few hours last night updating it.

The good news is that the computer now handles combat better. The computer is very aggressive when attacking. The AI code used to never attack with a 2/2 into a 1/4 and now it will. While attacking with just one 2/2 into a 1/4 is still a little stupid, the computer will attack with ALL of its 2/2 creatures if you have a 1/4. The idea is that the computer will still look stupid some of the time but it will improve the computer’s performance most of the time.

The attacking code is simpler than the blocking code because there are a variety of reasons to block: chump block to stay alive, trade creatures, bigger – block a 2/2 with a 3/3, shield – block a 2/2 with a 1/4, or have multiple blocker destroy a big creature.

I’ll talk about blocking next time.

p.s.
This post is comments on my post, "Two Kinds of AI" which is written by somebody who has more experience programming AIs than I do.

1 comment:

Forge said...

blogspot.com lets you schedule posts to be posted in the future but currently it is broken, so that is why my blog hasn't been updated in a few days. I'll post about AI blocking on friday.