Writing game AI

I'm kinda stuck on writing the AI for my first game. I have no idea where to start.. couldn't find any tutorials either. Any tips or advice would be appreciated a lot. Oh, and the game is turn-based strategy.

Thanks in advance
Turn based text or what? Also is the ai going to do the same strategy each time? Or is it going to vary/randomize what it does each time?
Not text, I think I'm going to use SFML to add some graphics. The AI will need to adjust its strategy based on what the status of the game is. Basically your objective is to conquer all bases on a randomly generated map. The economy, industry, and tech of each can be improved. Tech improves the strength of units trained at that base, industry the max number of units that can be purchased each turn, and economy the amount of money generated each turn, units cost money to maintain.
When I write AI, I first think of what I would do in the AI's position and why I did it. I write this all down and split it into steps. Tic-Tac-Toe AI example:

1. Check if I am going to win and place the final piece. I don't want the game to drag.
2. Check if I am going to lose and place a blocking piece. I don't want to lose!
3. Check if the other person is going to do some sly tricks and place a piece to get a tie.
4. Check for middle because there is a high chance that I will win/tie with it.
5. Okay, I can't do anything so randomly place the piece.
When I write a non-trivial game, I like to keep the game engine isolated from the user interface. I find it easier to debug the game using a text based front end to the game engine. Once I'm satisfied the game is working correctly with the text based front-end, then I focus on the graphics front-end using the very same game engine.
Topic archived. No new replies allowed.