Hi! What do you think is the best way to create a different level AI for a Connect Four Game?
I've seen the excellent example at Nivrams Site using the Advanced Game Board Extension. (Made for 2 players-game)
Thanks for your suggestions!
Richie
Hi! What do you think is the best way to create a different level AI for a Connect Four Game?
I've seen the excellent example at Nivrams Site using the Advanced Game Board Extension. (Made for 2 players-game)
Thanks for your suggestions!
Richie
I've found an interesting base to start, but have no idea how to create something like this in MMF:
http://www.ocf.berkeley.edu/~yosenl/...alphabeta.html
(Very interesting article about AI)







The way I've created AI for Checkers and for Tic Tac Toe is the same algorithm you'd want to use for computer AI in Connect Four: Minimax with Alpha-beta pruning. In simplest terms you are looking ahead and determining what the best move is based not on the quickest path to winning, but the quickest path that doesn't follow a route that is easily counterable by the opponent. This would have to be done in C++/Objective-C of course. Anything else would be random and not very useful.
So you dont think there's a way to transfer this into MMF2? or do a minimax routine inside mmf2? (advanced game board?)







Wow I tried so many ways but the real problem has to do with the complete absence of functions in the iOS exporter. The actual C++/Objective-C code for Minimax w/pruning is easy to carry over to anything from connect 4 to dominoes. Would have made my life so much better had it existed.
The only thing I can think of would be a loop that determines the computer's next move.
Something like: place an object in the top left corner and on the loop move the object one space over, check for collision. Repeat until it reaches the right edge of the screen, then bump it down one space and repeat.
After checking horizontally, check again from right to left, then from top to bottom.
You'd probably want to do several different loop throughs to check for available moves.
First looking for any existing rows of 3, starting with searching to see if the computer can make a match, then seeing if it can block. Maybe driop an invisible marker to mark all potential spots. If you have 2 markers overlapping, then that would be an ideal move.
Next, rows of 2
then looking for any single spots to block or place a piece
If nothing is found, drop a piece randomly.
This is what I'd try anyway.
sounds useful, but - sorry, i've no idea how to do this. where should i store the information?
I'll post this link if someone is interested in the 'Monte Carlo' Method :
http://beej.us/blog/data/monte-carlo-method-game-ai/
(AI based on random generation - works surprising well)