# Minimax

Root node cannot be removed

This tool allows you to create game trees and apply the Minimax algorithm to them.

## Instructions

To edit the tree, click on any node. This will display a menu with options to add a child or remove the node. Choose the desired option. To edit values, click on the text of the leaves and edit their value, then click outside the text to save the value and update the tree.

## What is Minimax?

Minimax is an algorithm used in strategy games, especially in two-player zero-sum games such as chess, checkers, and tic-tac-toe. The main objective of the Minimax algorithm is to find the best possible move for a player, assuming that the opponent is also making the best possible decisions.

The term "Minimax" comes from the strategy of the algorithm, which involves minimizing the player's potential loss while maximizing the opponent's potential loss. The algorithm examines all possible moves up to a certain depth in the game tree, where each node of the tree represents a game state, and the leaves of the tree represent possible final outcomes.

## How does it work?

The algorithm operates as follows:

- At each level of the tree, nodes alternate between being maximization nodes and minimization nodes.
- Maximization nodes (red triangle pointing up) seek the move that maximizes the node's value (score).
- Minimization nodes (blue triangle pointing down) seek the move that minimizes the node's value (score).
- The node's value is recursively calculated up the tree until reaching the root node, which represents the best move for the original player.

## Support this website

If this page has been useful, share it with your contacts by email, social networks,... etc.