Okay, what your AI will have to perform is the basis of all artificial intelligence, specifically, decision making.
There are many methods of programming an intelligence to make decisions. Condition Action rules (split into finite and fuzzy state machines), expert systems and neural networks to name the basic ones. Each of these can also be adjusted by adaptive learning or genetic algorithms.
Am I scaring you yet?
Personally, if you're inexperienced, I'd suggest you get your head around condition action rules first. The basic methodology of this (if there is a complex methodology) is identical to the IF THEN statement. Based on a set of criteria, which is basically the current state of the game at any one point in time, the AI cycles through a set of IF THEN clauses until one is triggered. This is a finite state machine, it uses distinct TRUE and FALSE values about a set of facts to determine an answer, everytime you run it with a set of values it gives an identical reasoning.
Fuzzy logic or fuzzy state machines don't work from TRUE/FALSE criteria, instead they weight values from various inputs from the current environment state and make a less distinct decision.
Here's an example to show the difference between finite and fuzzy state machines (often written as FSM and FuSM).
IF 2 * numberOfEnemies < numberOfAllies THEN attack
This would be a FSM making a logical decision which would always fire given the number of it's allies being at least double the number of it's enemies.
For a FuSM example of the same problem
AttackWeighting = ((NumberOfMyTroops * AverageQualityAlly) / (NumberOfEnemyTroops * AverageQualityEnemy)) + (AmountOfLandGained / EstimatedTroopsLost) + HateTowardsEnemy - EstimatedBadFeelingDueToAttack
if (AttackWeighting > 0.75 - aggression) then Attack
It can be as complicated or as simple as you feel necessary.
Most game AI is written as a mixture of FSM and FuSM and it should solve your problem fine.
The main difference is that values in FuSM (such as aggression and HateTowardsEnemy) are constantly changing throughout the game based on past events but FSMs and FuSMs are essentially the same idea.