What Is Mex Game Theory?


Diego Sanchez

Mex Game Theory: Understanding the Basics

If you are someone who loves mathematics and enjoys analyzing games, then Mex Game Theory is the perfect topic for you. In this article, we will discuss what Mex Game Theory is and how it works.

What is Mex Game Theory?

Mex Game Theory is a mathematical theory that deals with analyzing and solving games. It was first introduced by John Horton Conway, a renowned mathematician, in the mid-1970s. The “Mex” in Mex Game Theory stands for “mexican,” which refers to a traditional game played in Mexico.

How does it work?

Mex Game Theory involves analyzing two-player games where each player takes turns removing coins or objects from a pile. The players can remove any number of objects from the pile, but they have to follow certain rules. The player who takes the last object(s) from the pile wins the game.

To analyze such games, Mex Game Theory assigns a value to each game state. The value of a game state represents how favorable it is for the player who is about to make their move. In other words, it tells us who has the advantage in that particular state of the game.

Calculating values

The values of game states are calculated using a process called Sprague-Grundy function. This function assigns non-negative integers to each game state based on its position in the game tree.

For example, consider a simple game where there are four coins in a pile and each player can remove one or two coins on their turn. To calculate the value of this game state, we first need to find all possible moves that can be made from this state. In this case, there are two possible moves: either remove one coin or remove two coins.

We then calculate the Sprague-Grundy function for each resulting state (i.e., the state we get after making a move). If we assume that the value of an empty pile is zero, then the value of the original game state is given by the mex (minimum excluded) of these values.

For example, if after removing one coin from the original state, we get a game state with three coins in a pile, then its value is 0 because it’s an endgame. If after removing two coins from the original state, we get a game state with two coins in a pile, then its value is 1 because it can be reduced to an endgame by taking one coin.

Finally, since the mex of {0,1} is 2, we can conclude that the value of the original game state (i., four coins in a pile) is 2. This means that the player who is about to make their move has a disadvantage because their opponent has a winning strategy.


Mex Game Theory is a fascinating subject that combines mathematics and game theory. It provides us with valuable insights into how games work and how to analyze them. By assigning values to game states using Sprague-Grundy function and calculating mex of those values, Mex Game Theory allows us to determine who has the advantage in any given game state.