Developing character tactics via repeated trials
There are a few ways to tackle this. You could make an AI that is simply a series of IF statements, or you could actually make an AI that would actually take in the situation and come up with a sensible solution.


IF Approach - You make a series of IF statements that come up with a sensible action to execute. This is the method that Minecraft uses. The resulting action were recorded from some of the best players.
True AI - Have your Character execute random actions and learn the consequences of them. The, train it to execute various actions for certain scenarios.


The main difference between these two approaches is that IF statements have a constant and predictable behavior, while the AI approach has a very bad startup value but ends up improving over time.

There is no "best" method, it is up to you to choose one or the other or a mix of both.