Results 1 to 3 of 3
  1. #1
    jenxin is offline Member
    Join Date
    Feb 2011
    Rep Power

    Default Connect 4 AI help!

    I need help in making a AI for my connect 4 program. Specifically it's not just any connect 4, but to win, you must get a L shape.
    (ie. ***) . I am trying to figure out how to make a recursive method to give me the next best possible move based on the move depth.
    Having trouble figuring out the point system, and how to know if a move is better than another. Also maybe a general outline of how I should achieve this.

    Any help would be appreciated.


  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Voorschoten, the Netherlands
    Blog Entries
    Rep Power

    Default Re: Connect 4 AI help!

    Google for the 'mini-max', 'alpha-beta pruning' or 'Shannon A', 'Shannon B' methods; they all try to find a 'best' move in a game tree (recursion!) and an evaluation function.

    kind regards,

    Build a wall around Donald Trump; I'll pay for it.

  3. #3
    jenxin is offline Member
    Join Date
    Feb 2011
    Rep Power

    Default Re: Connect 4 AI help!

    Hmm, after looking at it, i'm not too sure on how to import past moves into play. In this program, the human player always goes first. Lets say after the computer makes the 2nd move, how would it test for all moves excluding the one's that are already filled out?

    maybe say at that spot, if it's not white, increment the column?

Similar Threads

  1. Connect Four
    By tabchas in forum New To Java
    Replies: 4
    Last Post: 05-03-2011, 01:11 AM
  2. Connect to wap
    By HoangNgoc in forum CLDC and MIDP
    Replies: 2
    Last Post: 12-23-2010, 09:13 AM
  3. connect through usb
    By taufiqbzz in forum Networking
    Replies: 0
    Last Post: 11-01-2010, 11:04 PM
  4. Connect Four
    By chick in forum New To Java
    Replies: 3
    Last Post: 05-04-2010, 04:33 AM
  5. how connect
    By herfnai in forum JDBC
    Replies: 1
    Last Post: 08-18-2008, 06:34 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