I've been trying to implement minimax algorithm in connect 4 but I encountered a problem that there are only two values to evaluate moves : infinity for winning game and -infinity for the opposite , and I need a huge deep to reach these values on the first moves , so what I need is an evaluation function but I don't have any idea how should it be ... any ideas ?
Asked
Active
Viewed 2,221 times
2 Answers
0
First, Connect 4 also allows for a draw, so you have three possible outcomes. Second, why would you use +inf and -inf when you can use +1 and -1? Third, the obvious starting place for a board evaluation function would be "number of tokens in a line."
But that is only a starting point.

Novak
- 4,687
- 2
- 26
- 64
-
OK you are right but how should I evaluate neutral moves and what values can I give them if they are only between 1 and -1 – Dec 26 '13 at 21:49
-
You're allowed to use floats or even doubles, not just ints. Or if you really want to use ints, widen the range up a little. You're also allowed to experiment a little bit. – Novak Dec 26 '13 at 22:55
0
A good Evaluation function for the game Connect Four would analyze the threats of both players. The article Expert Play in Connect-Four from James D. Allen is a great source for studying and analyzing the game. To get a clue on how to create a evaluation function read the chapter Threat Analysis carefully.
Good Luck!

Christian Ammer
- 7,464
- 6
- 51
- 108