I am trying to have my Minimax AI chess players play against each other.
I was a bit confused about an implementation detail.
black my first minimax AI chess player that plays first.
white is the other minimax AI that goes second.
My question s about the turn. Should
black maximize and
white minimize OR should they just try to maximize when at their respective turns, with the evaluation function flipped?
I have thought up of two ways to go about this. I have a feeling that they are doing the same thing, but just wasn't sure whether I am right or the two solutions are in fact doing something different.
Instantiate a MinimaxAI object for
white separately. Make sure that
black's evaluation function is the opposite of
white. For a simple example, the object
black's evaluation function is
number of black pieces on board - number of whites on board.
white object will have an opposite evaluation function
number of white pieces on board - number of blacks on board.
Now, when each object takes turns to call the same
get_next_move method, they will both be the
maximizing player of the minimax algorithm.
Instantiate one Minimax AI object
ai to be used by both the
black and the
white as they alternate turns.
white will have the same evaluation function
number of white pieces on board - number of blacks on board
white always goes first in chess, when
ai.get_next_move with an even turn number, it will be given the
maximizing player role. On the other hand, when
ai.get_next_move with an odd turn number, it will be given the
minimizing player role.
(this is what I have so far)
I think both should result in the same behavior, but it is more of a feeling than an educated opinion. Please let me know if my feeling is actually correct or not. A semi-formal reasoning process will be welcome!