IS Week 6

In week 6, Me and Vincent realized that a star algorithm was not the optimal solution we were looking for. So, we looked for different algorithms and we tried implementing it. He tried implementing Minimax Algorithm while I tried to implement a different approach using the Negamax Algorithm.

So for my Negamax algorithm implementation, the code for it is actually quite similar to Vincent’s Minimax implementation as Negamax can be considered a variation of Minimax. But, before we get to the code, I will first explain about the theory of Negamax algorithm.

Theory

Negamax is a variant of Minimax, where the value of a position to player A in the game is the negation of the value to player B. So, players will look for a move that maximizes the negation of the value of the position resulting from their move, which means that the next position must have been valued by the opponent. This works for both players directly rather than player A selects the move with maximum value while player B selects the move with the minimum value.

This is the screenshot of the code implementing the Negamax algorithm

Leave a Reply

Your email address will not be published. Required fields are marked *