Hey everyone, I am developing a connect four clone, I have just about all the features developed that I want, but the AI is to easy. As of right now, I have a list of "Attack" moves that will make the Computer Win, and a list of "Defend" moves that will block the players wins. If it cannot see either of those possible moves, it places randomly. The game plays, but it is far to easy to trick the computer. I find it to be far to close to equivalent of a novice player. I see the problem that it cannot look into the future. It can only 'see' what is currently being played.
So I decided to implement the MINIMAX tree, with a simple pruning algorithm. As I have no experience in this area, and only have a general idea of MINIMAX, could I get some help? I under stand the basic premise of the algorithm, yet I cannot seem to get an idea of how to implement this.
I have an array holding the play field data, 0 being empty, 1 being the player, and 2 being the computer. Player one goes first. And the loser goes first the next game. Regardless, I have no idea on how to start implementing this.
Would I hold an array of the play field for each possible move? Or would I have an array for a set of moves and score that array? I guess the latter would save a lot of memory,
Then, would I use a for loop on each set of moves to create an array for a different move? Then check to see if that move is a win or lose, and if not, do it again?
I guess what I am looking for is a very simple pseudo code version of what I have to do.
Thanks for your help guys.
How to get started with MINIMAX for my Connect Four Clone
There is a thread on this subforum just below your own. There might be some relevant info in it....
Here's a link
Here's a link
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement