How to implement AI?

Im planning a turn-based strategy game.

But the problem is, how to implement AI for it in code level?

I was thinking that when it is computer’s turn, some method would be launched. This method would get the “world” as parameters so it could place the computer’s soldiers to correct places etc…

That sounds acceptible, probably it would work too. But how is the AI applied usually in turn-based games? Any hints what I should avoid? etc?

I always implement AI within my loop after the controls have been polled and executed.
I give the AI the exact same controls as the player, no more, no less.
The game itself handles who moves first or not.
Once you poll the inputs and the AI has also buffered it’s moves, you execute them within the order you want.

Thanks for the answer.

That sounds like a pretty good way to do it. That way I think I could get the camoflaged units to be camoflaged even for the computer :slight_smile: