From the course: AI Algorithms for Gaming

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Minimax example

Minimax example - Python Tutorial

From the course: AI Algorithms for Gaming

Start my 1-month free trial

Minimax example

- [Instructor] So let me show you how minimax works on the tree we just saw. The only argument we need is the current state of the game at the moment we are called to produce our next move. This is the top min node. Now recall that minimax operates in a depth first traversal. This is the order of evaluation you'll see in this example, we'll go from left to right. Recall that we have three possible moves, A, B and C. So the agent is going to decide which of these three moves minimizes our maximum loss. Or in other words, which of these moves will yield the best result for us. Since this is a max node, we are going to choose the maximum of these three options. So we start by analyzing move A. This produces a new state in a min node, which in turn has three possible moves. Notice that to choose the minimum value here, we need the values, so we need to dig deeper. Starting at the leftmost move, which takes us to yet another…

Contents