Wednesday, July 8, 2009

AI Blocking

Knowing when to block is almost a science and trying to distill those nuggets of knowledge into hard, inflexible code is challenging. The computer will block each attacking creature 50% of the time. (If you have four attacking creatures the computer will usually block two of them.) While this might seem arbitrary it also makes the computer less predictable. (Maybe 50% should be something else like 30% but I really don’t know.)

And finally the bad news, the computer still does a few stupid things. The AI doesn’t take into account activated abilities or a creatures “worth”. The AI sees Royal Assassin, Soul Warden, and Eager Cadet as all the same, just a 1/1 creature. On the bright side the AI does take into account first strike, double strike, deathtouch, and flying. Occasionally, 20% of the time, the computer will block a non-flyer with a flyer or not attack with a creature just to surprise you.

The computer also checks to see if it can win the game by attacking with all of its creatures. I nicknamed this “assault attacking” in my code. The programming is a little tricky because it presumes that the biggest attacking creatures will be chump blocked.

5 comments:

  1. -The computer also checks to see if it can win the game by attacking with all of its creatures. I nicknamed this “assault attacking” in my code.

    However, it seems to be missing "anti-assult blocking" code, i.e. when I attack with a 5 4/4's it doesn't block anything with its 1/1.

    ReplyDelete
  2. Hi, I just downloaded this. However, the pictures aren't showing up. Did I do something wrong?

    ReplyDelete
  3. If you haven't found it yet, there's a menu function to download the card pics. It takes a while, give it at least 5 - 10 minutes even on a cable modem.

    ReplyDelete
  4. D'oh!

    Yeah, got it.

    Thank you so much for making this whole thing, it's inspired tons of new strategies!

    Keep up the awesome work! : )

    ReplyDelete
  5. "However, it seems to be missing "anti-assult blocking" code, i.e. when I attack with a 5 4/4's it doesn't block anything with its 1/1."

    I did find this mistake and it is fixed on my home computer, I'll release a new version of MTG Forge soon. I'm still trying to perfect the attacking and blocking code.

    ReplyDelete

Note: Only a member of this blog may post a comment.