AI Algorithm for 5-In-Row game.
Posted on 2003-03-22
I started on a project a few days ago and made a 5-In-Row game ... a game like tic-tac-toe but with a game plan at 25*25 squares and to win you need 5 in a row. It was no problem to get this game to work on a single computer and will make it work through network too.
My question here is if anyone here has any clue on how to make a good Algorithm for an AI, I have though a lot about this and it is defiantly not easy.
Lets say the Player is X and the AI is O then a good start should perhaps be to check around where the player puts its X to se if he have any other X close to the one he just put out and then try to stop him. Like this:
' _ _ _ _ _ _ _ _ _
' |_|X|_|_|X|_|_|X|_| here the X is where to check if the player put his
' |_|_|X|_|X|_|X|_|_| mark at the 0
But the AI also has to think on putting its own O as good as possible to get a chance to win.
I have never done any AI stuff before and don't know if I’m thinking in the right line. Would be great if someone of you guys could give me some help and/or some hints on this.
I'm programming this game in vb.net but the language shouldn't be of so much concern, I want to know how to think to get a good algorithm for this AI in the game.