minimax Algorithm

Minimax (sometimes MinMax, MM or saddle point) is a decision rule used in artificial intelligence, decision theory, game theory, statistics, and doctrine for minimizing the possible loss for a worst case (maximal loss) scenario. Originally formulated for two-player zero-sum game theory, covering both the cases where players take alternate movements and those where they make simultaneous movements, it has also been extended to more complex games and to general decision-making in the presence of uncertainty.

minimax source code, pseudocode and analysis