Group theory in games

Some popular mathematical games have a group-theoretic foundation, and in some cases, group theory helps provide strategies to win these games. In this article we discuss how the different facets of the definition relate with the different ways in which groups turn in in games.

Groups, games and moves: the loose idea
Group are useful in modeling games that involve a series of discrete moves, with each move leading to a change in the board state. The loose idea is to identify each possible move with an element of a certain huge group, where the effect of performing a sequence of moves corresponds to the product of those elements. However, not every game with moves can be modeled using a group. Let's first look at some examples of games:


 * The fifteen puzzle is a game involving fifteen pieces labeled 1-15 on a four-by-four board. There is one blank space, which, at the beginning, is the one on the lower right corner. A move of the game involves moving a piece into the current blank space from one of the positions sharing an edge with it. The goal is to reach some other specified configuration of the board.

Each move can thus be specified by stating which piece goes into the blank space. Alternatively, it can be specified by stating which position the piece moves from, and which position it goes to. Performing a sequence of moves gives some rearrangement (permutation) of the group. Thus, the group modeling this game is the group of permutations on sixteen letters, with the moves being a (restricted) set of elements of the group, and the composition of moves resulting in the multiplication of the corresponding group elements.


 * The Rubik's cube is another game where the various moves involve specific permutations of the individual cubes. The group here is thus the group of permutations on all the cubes (26 in number, because the central cube is left intact by all operations). The individual moves permissible constitute a small subset of this group, and the question of interest here is: what elements of the group can be expressed as products of moves?

The definition of group
A group is a set $$G$$ with a binary operation $$*$$ satisfying the following three conditions:


 * Associativity: $$a * (b * c) = (a * b) * c$$ for all $$a,b,c \in G$$.
 * Identity element: There exists $$e \in G$$ such that $$a * e = e * a = a$$ for all $$a \in G$$.
 * Inverse elements: For every $$a \in G$$, there exists an element $$b \in G$$ such that $$a * b = b * a = e$$. Such a $$b$$ is termed $$a^{-1}$$.

The definition of generating set
A subset $$S$$ of a group $$G$$ is termed a generating set for $$G$$ if every element of $$G$$ can be expressed as a product involving elements from $$S$$ and their inverses.

Given a group $$G$$ and a subset $$S$$, the subgroup generated by $$S$$ is defined as the subgroup of $$G$$ comprising elements of $$S$$ and their inverses.

A setup relating games and moves to groups and generating sets
The game has a set of legal configurations. For instance, in the fifteen puzzle, this is the set of all ways of placing fifteen numbers 1-15 on a $$4 \times 4$$ board. In the Rubik's cube puzzle, this is the set of all visible arrangements of the Rubik's cube.

This set of legal configurations may come with an associated group. For instance, the set of all arrangements of the numbers 1-15 on a $$4 \times 4$$ board is naturally associated with the group of permutations on sixteen letters, because each arrangement can be viewed as a permutation of sixteen letters (the numbers 1-15 and the blank space). Similarly, the set of legal configurations for the Rubik's cube is associated with the set of all arrangements on 26 letters, because there are 26 little cubes to be moved around.

The group acts on the set of legal configurations. Any permutation of sixteen letters takes as input an arrangement of the fifteen puzzle board and outputs another arrangement.

Every move is an element of the group, as it takes in a legal configuration and outputs a new legal configuration -- the one obtained after performing the move.

A few points of note here:


 * Identity element:The identity element of the group is the element we get by doing no moves at all.
 * Legal moves: There is a fundamental difference between the fifteen puzzle and the Rubik's cube. In the fifteen puzzle, the set of legal moves depends on the current configuration (because a legal move must involve the current blank position and an adjacent position). On the other hand, in the Rubik's cube puzzle, the set of legal moves is independent of the current configuration.
 * Inverses and reversible games: In both the Rubik's cube and the fifteen puzzle, the inverse of every legal move is a legal move. In other words, every move can be undone in the next move, or could have been the result of undoing a previous move.

The questions now are as follows:


 * What elements of the group are expressible as products of legal moves? In other words (due to reversibility of moves), what is the subgroup of the big permutation group generated by all the legal moves?
 * Given an element that is expressible as a product of legal moves, how short can we make the expression for it?