Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 13 Jan 2013
Offline Last Active Jan 16 2013 09:56 AM

#5021914 Best practice needed for implementing an AI for a turn-based game

Posted by on 15 January 2013 - 02:16 PM




I am dabbling into game making by implementing a boardgame (Hive) I have at home. I am doing this in C++ (with Qt) and have more less the basics I need for a player vs player game.


I will now try to make an AI for the game, but I've come to face with a couple of decisions and I wonder whether you guys could give me some advice?


My question boils to the fact whether I should make a separate "board" for the AI to evaluate and test its moves or to use some kind of undo function (so make all the moves and then move all the pieces to their original position).


Making a separate move does not appeal to me because it involves making deep copies of the objects (I only keep pointers to them, and the game logic depend on the pointers in lists). However, using an "undo" function, requires me to tell the game the AI is thinking, because right now any change to the internal game causes the GUI part to move as well.


What is common practice in this case?


Thanks in advance,