Thread: C Language: Connect 4 AI-Min/Max Trees

  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    103

    C Language: Connect 4 AI-Min/Max Trees

    Hello, I'm working on a project c4.c which will develop a min-max based AI. This is for a class. Our AI will compete with other groups in our class on a common interface. We've already developed our code to have a board, X and O as players, and they go and such.

    Right now, our AI is overly too simple. If it moves first, it will put the first piece in the middle column. After that, it just fills up the first column. Our teacher told us he's expecting us to develop min-max trees. We've never done anything with min-max so our experience is 0 in this area. Consequently we've mostly just been doing research.

    My question is this, how do you implement min-max trees? Is it some sort of data structure? From my research, I'm figuring out a scoring system where "winning piece" gets a value 1,000,000 demanding its priority, and otherwise will be recursive. I've read about alpha-beta(no clue what that is) and transposition tables (again, no clue). These all seem beyond the scope of our course (but not the scope of some of the students in our class T_T). Any advice on how to start? As my partners and I have no idea how coding should even begin for min-max trees.

    Sorry for such a long post, just wanted to make sure the situation was fully understood.

    So far, the conceivable strategy we have come up with is this:

    -when it checks for a move in a certain column, calculate how many lines of 4 that piece can become a part of. The more lines, the high the score value.

    -checks for opponents' response to that move, find the lowest highest value and up the score of the move it's associated with

    ---

    However, this AI seems way too easy to beat T_T

  2. #2
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472
    There will be loads of web information on this, i cant give you any specific implementation tips as i have never coded this AI, but this wikipedia page is a good overview and this tutorial is a good discussion of basic AI with some example code snippets

  3. #3
    Registered User
    Join Date
    Jan 2010
    Posts
    103
    Heh thanks for your help. As for my Connect 4, I've made everything work in the board. Now I just need to develop the AI intelligence!! ^_^

  4. #4
    Registered User
    Join Date
    Jan 2010
    Posts
    103
    Hey! It's done!! If I want people to play against it online, what should I do?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Connect four AI demo
    By Sang-drax in forum Game Programming
    Replies: 6
    Last Post: 06-15-2004, 09:21 AM
  2. Client timed-out once on connect(), can never connect() again
    By registering in forum Networking/Device Communication
    Replies: 6
    Last Post: 10-28-2003, 03:46 PM
  3. Replies: 4
    Last Post: 04-25-2002, 05:41 PM
  4. Technique of all board-like games?
    By Nutshell in forum Game Programming
    Replies: 28
    Last Post: 04-24-2002, 08:19 AM
  5. Replies: 4
    Last Post: 12-12-2001, 12:06 AM