Jump to content

  • Log In with Google      Sign In   
  • Create Account


How to get started with MINIMAX for my Connect Four Clone


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 KadajettGaming   Members   -  Reputation: 104

Like
0Likes
Like

Posted 26 June 2012 - 09:05 PM

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.

Sponsor:

#2 szecs   Members   -  Reputation: 2102

Like
0Likes
Like

Posted 26 June 2012 - 10:55 PM

There is a thread on this subforum just below your own. There might be some relevant info in it....

Here's a link

Edited by szecs, 26 June 2012 - 10:56 PM.


#3 KadajettGaming   Members   -  Reputation: 104

Like
0Likes
Like

Posted 26 June 2012 - 11:45 PM

Sorry, I put this up and then saw it, very relevant info lol So I will attempt to delete this if I can, if not, have at it mods :P




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS