Search code examples
javaartificial-intelligenceminimax

how to get the value of terminal nodes in minimax algorithm for connect4


I'm trying to implement a connect4 game with a different concept using Minimax algorithm in Java.

I completely understand the minimax algorithm. However when coming to the implementation, I cant figure out what will be the terminal values in this case.

In the videos and notes that I've referred, they always showed a terminal value at the terminal, so my question is How do i get those terminal values for the connect4 game.

Do i put some kind of probability of making a set of 4 at those terminal or something?.Please help.

Thank you


Solution

  • As connect can be played perfect with todays computers, there can be values +1, 0 and -1 assigned to every terminal node dependig on the result (win, draw, loose).

    If your program is unable to search the whole three, you will have to write socalled evaluation heuristics, returning a number determining wether a position is good or bad. (So yes, in your words: the winning probability of a position)

    You can achieve that for example by counting the amounts of 2 in a row and 3 in a row.

    Better heuristics will result in better play of the engine.