User Tag List

Results 1 to 8 of 8

Thread: Connect Four AI?

  1. #1
    Clicker

    Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleUnicode Add-onInstall Creator Pro
    StingRay's Avatar
    Join Date
    Nov 2006
    Location
    Austria
    Posts
    1,057
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)

    Question Connect Four AI?

    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

  2. #2
    Clicker

    Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleUnicode Add-onInstall Creator Pro
    StingRay's Avatar
    Join Date
    Nov 2006
    Location
    Austria
    Posts
    1,057
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    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)

  3. #3
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export Module

    Join Date
    Aug 2011
    Location
    Beverly Hills, CA USA
    Posts
    508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  4. #4
    Clicker

    Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleUnicode Add-onInstall Creator Pro
    StingRay's Avatar
    Join Date
    Nov 2006
    Location
    Austria
    Posts
    1,057
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    So you dont think there's a way to transfer this into MMF2? or do a minimax routine inside mmf2? (advanced game board?)

  5. #5
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export Module

    Join Date
    Aug 2011
    Location
    Beverly Hills, CA USA
    Posts
    508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  6. #6
    Clicker Fusion 2.5 DeveloperiOS Export ModuleSWF Export Module
    Pineapple's Avatar
    Join Date
    Oct 2010
    Posts
    431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  7. #7
    Clicker

    Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleUnicode Add-onInstall Creator Pro
    StingRay's Avatar
    Join Date
    Nov 2006
    Location
    Austria
    Posts
    1,057
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    sounds useful, but - sorry, i've no idea how to do this. where should i store the information?

  8. #8
    Clicker

    Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleUnicode Add-onInstall Creator Pro
    StingRay's Avatar
    Join Date
    Nov 2006
    Location
    Austria
    Posts
    1,057
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    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)

Similar Threads

  1. Can't... connect... to anything...
    By Konidias in forum Lacewing
    Replies: 12
    Last Post: 18th June 2011, 03:42 AM
  2. cant connect?
    By Gibbon in forum Lacewing
    Replies: 7
    Last Post: 17th November 2010, 12:44 PM
  3. Connect the Dots
    By rogiedodgie32 in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 31st January 2010, 07:29 PM
  4. Connect 4
    By Deano in forum The Games Factory 2 - Technical Support
    Replies: 8
    Last Post: 29th January 2007, 01:28 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •