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

1. 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. 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. 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. Hey! It's done!! If I want people to play against it online, what should I do?