Learning AI with memes — MinMax Algorithm

Kashish Madan
3 min readMay 7, 2020

--

The MinMax algorithm is a way of finding an optimal move in a two-player game. The goal of this algorithm is to find the next best optimal move. Breadth-First Search is not used as the MinMax algorithm searches down to a certain depth.

The story begins — Two people named MIN and MAX are playing a game. The game usually begins with MAX taking the first chance.

Both players will use “Best Move” strategy

There are a few rules in the game. First, there will be a Game Tree with n number of nodes and having a depth d. In this tree, the root node will always be MAX as it starts the game. Then alternatively, turns will be assigned to MIN & MAX.

The Game Tree (somewhat) looks like this

The MinMax algorithm uses back-tracking. Therefore, we will always start from the terminal/leaf node and move to the top/root node.

Backtracking Algorithm

For every level, if it is MAX then it will try to maximize its utility. Therefore, MAX will select the child with a greater value. Whereas, MIN will try to minimize the utility of MAX. Hence it will select the node with a lesser value.

Selecting the node to maximize or minimize the utility

As we move up by each level and reach the root node, we have our optimal value.

Time Complexity Analysis:
Let the Graph tree contain b branches and a depth d. Since all nodes are traversed at least once before reaching the root node, the Time Complexity will be O(b^d).

Now, this might seem okay in the example above, but for games like Chess, this time complexity can reach around O(35¹⁰⁰). Hence, there exists an advanced version of the MinMax Algorithm called — Alpha-Beta Pruning.

Hello!

If I managed to retain your attention to this point, leave a comment describing how this learning AI with memes made a difference for you, and what other topics should I cover!

Connect with me on LinkedIn or say Hello! on Twitter. Feel free to reach out to me via email at kashish.madan@outlook.com for any queries and suggestions!

--

--

Kashish Madan
Kashish Madan

Written by Kashish Madan

Here to just share some of the things that fascinate me!

No responses yet