Question

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 ?

Was it helpful?

Solution

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.

OTHER TIPS

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!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top