minimax.cpp File Reference

returns which is the longest/shortest number using minimax algorithm More...

`#include <algorithm>`
`#include <cmath>`
`#include <iostream>`
`#include <array>`
Include dependency graph for minimax.cpp:

## Namespaces

| backtracking
| Backtracking algorithms.

## Functions

template<size_t T>
int | backtracking::minimax (int depth, int node_index, bool is_max, const std::array< int, T > &scores, double height)
int | main ()

## Detailed Description

returns which is the longest/shortest number using minimax algorithm

Minimax (sometimes MinMax, MM or saddle point) is a decision rule used in artificial intelligence, decision theory, game theory, statistics, and philosophy for minimizing the possible loss for a worst case (maximum loss) scenario. When dealing with gains, it is referred to as "maximin"—to maximize the minimum gain. Originally formulated for two-player zero-sum game theory, covering both the cases where players take alternate moves and those where they make simultaneous moves, it has also been extended to more complex games and to general decision-making in the presence of uncertainty.

Author
  Gleison Batista
  David Leal

## Function Documentation

## main()

int main | ( | void |  | ) |

Main function

{
std::array<int, 8> scores = {90, 23, 6, 33, 21, 65, 123, 34423};
double height = log2(scores.size());
std::cout << "Optimal value: " << backtracking::minimax(0, 0, true, scores, height)
<< std::endl;
return 0;
}
std::array
height
int height(node *root)
Definition: avltree.cpp:31
std::cout
std::endl
T endl(T... args)
backtracking::minimax
int minimax(int depth, int node_index, bool is_max, const std::array< int, T > &scores, double height)
Definition: minimax.cpp:38
std::array::size
T size(T... args)
Here is the call graph for this function: