Implementing Minimax
Minimax is an algorithm based on minimizing the possible loss for the worst case (maximum loss). Besides game development and game theory, Minimax is a decision rule that is also used in statistics, decision theory, and philosophy.
This technique was originally formulated for the two-player zero-sum game theory, meaning that one player's win is the opponent's loss. However, in this case, it is flexible enough to handle more than two players.
Getting ready...
It is important to know the difference between a dynamic member function and a static member function, as well as recursion. A dynamic member function is bound to the instance of the class, while the static member function is bound to the class itself. The static method allows us to call it without instantiating an object. This is great for general-purpose algorithms, such as the ones we'll be developing in this recipe.
In the case of recursion, it's not always clear (differing with iteration) that this is an iterative...