Minimax Algorithm Calculator

Read the Theory Guide →

Build a game tree, enter your own leaf values, and step through Minimax to see how values move through the tree and determine the final result.

What You Can Explore

  • Build and modify the game tree by adding, connecting, moving, or deleting nodes.
  • Change leaf values and run the solver to see how the values above them respond.
  • Step through the search to follow how each node receives and updates its value.
  • Change the tree structure or add and remove branches to see how the final result changes.
Core Mechanics
▼
  • MAX takes the Maximum: MAX seeks the highest possible score, assuming the best possible move for itself. It looks at all of its evaluated children and pulls up the largest number.
  • MIN takes the Minimum: MIN seeks the lowest possible score, assuming the opponent plays perfectly against you. It looks at all of its evaluated children and pulls up the smallest number.
  • Bottom-Up Evaluation: Interior nodes have no initial value. The algorithm must reach the terminal leaf nodes first, then pass those utility scores back up the tree layer by layer.
  • Exhaustive Search: To guarantee the mathematically optimal move, basic Minimax must evaluate every single leaf node. There are no shortcuts and no pruned branches.
Initializing Workspace...

Understanding Your Result

The solver calculates the result from the tree and values you entered. Use the step-by-step states to follow how child values move upward through the tree and see which values determine the final root result.

  • The final value at the root is the result determined from your current game tree.
  • Each step shows the current tree state and how a node's value changes as its children are evaluated.
  • At MAX nodes, the higher child value is carried upward; at MIN nodes, the lower child value is carried upward.
  • After changing a leaf, follow the path from that leaf toward the root to see which node values are affected by the change.

Try These Experiments

Change the Lowest Leaf

Setup: Run the preloaded tree and note the value returned by Branch A and the final value at the root.

Action: Change the lowest leaf under Branch A from -3 to 20, then run the solver again.

What to Observe: Step through Branch A and the root. Compare the value Branch A returns before and after the change, then check which value the root selects.

Takeaway: A change to the lowest child of a MIN node can change the value passed upward and, if that value becomes more favorable to MAX, can change the final root result.

Change a Non-Decisive Leaf

Setup: Run the preloaded tree and identify a leaf under Branch A whose value is higher than another child of the same MIN node.

Action: Increase that leaf substantially while leaving the other values unchanged, then run the solver again.

What to Observe: Compare the value returned by Branch A and the final root value with the previous run. Follow the step where the changed leaf is evaluated and see whether it changes the value selected by Branch A.

Takeaway: A leaf can be evaluated without determining the value passed upward. Under a MIN node, a larger child does not affect the result while a smaller child remains available.

Add Another Option

Setup: Run the preloaded tree and note the value currently returned by Branch A.

Action: Add another leaf under Branch A with a value lower than its current children, connect it to the branch, and run the solver again.

What to Observe: Check how the new leaf changes Branch A's value and whether the root now selects a different branch.

Takeaway: Adding an option can change the value passed upward when that new option becomes the one selected at the node. The effect can then continue through the nodes between that branch and the root.