 <p>Minimax with Alpha-beta pruning that Lirik mentioned is a good place to start, but it takes some time to wrap your mind around if you're not familiar with it.</p> <p>Alternatively you can think about how you would play the game if you had a perfect memory and could do fast calculations and try to implement that. The upside is that's usually easier to understand. </p> <p>Minimax would probably result in shorter but more difficult to understand (for those unfamiliar with it) code that depending on the game, could result in playing a perfect game if the game is simple enough (however it also has the disadvantage of favoring not losing to winning because it assumes the opponent will be playing perfectly as well) </p> <p>Since it sounds like it's a game of complete information (the whole board is visible to all players at all times) a properly implemented Minimax with infinite look-ahead could give an AI that would never lose (assuming infinite computation time). In games using Minimax the difficulty level is often determined by how many moves ahead the algorithm looks at. It gets exponentially slower the more steps there are, so you will run into a hardware limitation if the game isn't super simple (which is why there isn't a perfect Chess playing AI yet, I think last I checked it would take a couple thousand years on the fastest computer at the time of the article I read, sorry no citations)</p>