Forge is sometimes really stupid when it comes to combat. Deciding when to attack or block is a very thorny issue. (Well…most things in Magic are thorny aren’t they?) I wrote the AI combat code and although I’ve rewritten it once, it still has some major flaws.
First let me state that the code works well but is restricted by the overall combat architecture, which I did designed. The code answers the question, “Should this one creature attack?” While this question is important, it leads the AI down the wrong path and makes it look stupid. The correct question would be “What is the best way that all of the creatures should attack?”
So now we know that the AI makes attacking and blocking decisions by only looking at each individual creature but that doesn’t approach the intellect of playing against a real human opponent. A better AI would have to do an actual search and try to find good combat scenarios. (Doing an actual search may take 5-30 seconds but this is just a guess.)
Right now the alpha-beta search algorithm could be applied to Forge but it wouldn’t take into account activated or triggered abilities. Each ability is hardcoded and tries to find a good target, the AI doesn’t have a way to make an ability try different targets. The AI code would only see regular creatures with a few simple abilities like flying, vigilance, and trample. Also the code might not work with the rest of the program because of the overall architecture, which I designed on-the-fly.
So butter by backside and call me a biscuit, I think that’s all I have to say. Hopefully the computer occasionally surprises you with a good play.
The blocking code is more complicated that the attacking code because you can have multiple blockers. And the attacking code does look to see should it attack with all of its attackers in order to win.
The blocking code tries to see the situation when the AI might attack with everything and then you attack with everything and easily win. Unfortunately I messed up the logic so even that doesn’t work sometimes and it actually makes the AI seem more stupid since it doesn’t race. (Racing is when you attack with everything and then your opponent attacks with everything.)
If the AI could figure out should it race or not, that information would really improve the AI’s performance. (If the computer shouldn’t race, it would attack less and block more, thus making the game go longer because the AI would be trying to topdeck something good.)