Hi, I've been working on a c++ game of connect 4. It uses a multidimensional array, and I have a function that is capable of checking if someone has won. However, ai is really bugging me. I've tried to do some research on this minimax thing, but I couldn't find anything helpful. If someone could explain how it would work for a game of connect 4 in layman's terms (maybe with psuedocode) or refer me to some websites that will actually help me understand, I would greatly appreciate it.

Recommended Answers

All 4 Replies

Please use one forum or the other for these types of posts or at least link them so people don't waste time aswering here when it's being answered over here.

Not a clue what you don't understand. A MIN and MAX are quite obvious so without knowing what bugs you, we can't very well answer your non-question.

I've tried to do some research on this minimax thing, but I couldn't find anything helpful.

How much did you search? I just googled connect four c++ minimax and I found this video on youtube. In the description of that video, I found this link, There, you can see a functional implementation of minimax for connect four, which is as good as pseudocode, followed by a detailed explanation. If this is not enough, the guy has also coded implementations in several other languages (including c++), and you can view the full source code on github. And if you want to test his ai, you can play against it on your browser.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.