User:Mattj2/sandbox/Arimaa rules complete

Rules
Arimaa is played on an 8×8 square board. There are four trap squares which allow pieces to be captured. The two players, Gold and Silver, control sixteen pieces each: one elephant, one camel, two horses, two dogs, two cats, and eight rabbits.

Goal
The game can be won by: A player loses if it is their turn and they have no legal moves. In addition, a player can forfeit by resigning voluntarily or (if a clock is being used) if he or she runs out of time.
 * 1) Successfully moving a rabbit to the eighth row of the board.
 * 2) Capturing all enemy rabbits.

Notation
The rows (ranks) are numbered from one to eight starting from the one closest to Gold. The columns (files) are called by the letters "a" through "h" starting from Gold's left.

Setup
First Gold sets up his 16 pieces in any order on the two rows closest to him. All 16 million possible combinations are legal. After seeing Gold set up, Silver then sets up her pieces however she wants on the two rows closest to her. Gold has the advantage of moving first but Silver has the advantage of being able to react to Gold's setup.

Movement
Most pieces move one square at a time forward, backward, left, or right. Rabbits can only move forward, left, or right. Moving a piece one square is a step.

A turn consists of one to four steps. After the setup phase is completed the players alternate turns with Gold moving first. For example, Gold to move in Figure 2 could play:
 * 1) Horse from a2 to a3
 * 2) Dog from b2 to b3
 * 3) Camel from d2 to d3
 * 4) Elephant from e2 to e3

Silver could then play:
 * 1) Elephant from d7 to d6
 * 2) Elephant from d6 to e6
 * 3) Elephant from e6 to e5
 * 4) Elephant from e5 to d5

The steps in a turn can be used on four different pieces, all on the same piece, or any combination. A step can only be made into an unoccupied square.

Restrictions on Repetition
A player may not pass his or her turn, and each turn must make a net change to the position. Thus one cannot, for example, take one step forward and one step backward with the same piece as their only two steps of a turn. Furthermore, one's turn may not create the same position with the same player to move as has been created twice before.

Capturing
The board has four specially marked trap squares located at c3, c6, f3, and f6. If a piece is on a trap square and it is not next to any friendly pieces it is immediately captured and permanently removed from the game.

Strength
Some pieces are stronger than others. Stronger pieces can push, pull, and freeze weaker enemy pieces. The order of pieces from strongest to weakest is:

Freezing
Stronger pieces can freeze weaker enemy pieces. If a piece is next to a stronger enemy piece and it is not next to any friendly pieces, the weaker piece is frozen and cannot be moved. For example, elephants can freeze camels because elephants are stronger than camels.

In Figure 3:
 * The gold horse on b6 freezes the cat on b7 because horses are stronger than cats.
 * The g7 cat is not frozen because it is next to the silver rabbit.
 * The b3 elephant freezes the b2 camel, which in turn freezes the c2 dog.
 * Pieces of the same strength do not freeze each other. The g3 and h3 dogs are not frozen.

Pushing
At the cost of two steps, a stronger piece may push a weaker enemy piece. First the weak piece moves one step forward, backward, left, or right into an empty square. Then the stronger piece moves into the square that was just vacated.

In Figure 4, the b6 horse can push the b7 cat:
 * 1) The b7 cat moves one step to a7, b8, or c7.
 * 2) The b6 horse moves to b7.

The b3 elephant can push the b2 camel:
 * 1) The b2 camel moves one step to a2 or b1.
 * 2) The b3 elephant moves to b2.

The g7 dog cannot be pushed. Even though it is next to a stronger enemy piece, there is no empty square next to the dog where the dog could be pushed.

A piece that is frozen may not push or pull another piece, but it can be pushed or pulled by another piece.

The b2 camel is frozen and cannot push the b2 dog.

Equally strong pieces cannot push or pull each other.

The dogs on g7 and g8 cannot push each other.

Rabbits can be pushed backwards but they cannot move backwards voluntarily.

Pulling
At the cost of two steps, a stronger piece may pull a weaker enemy piece. First the stronger piece moves one step forward, backward, left, or right into an empty square. Then the weaker piece moves into the square that was just vacated.

In Figure 5, the b7 horse can pull the b8 cat:
 * 1) The b7 horse moves one step to a7, b6, or c7.
 * 2) The b8 cat moves to b7.

The b2 elephant can pull the b1 camel:
 * 1) The b2 elephant moves one step to a2, b3, or c2.
 * 2) The b1 camel moves to b2.

The g6 dog cannot be pulled. Even though it is next to a stronger enemy piece, there is no empty square next to the g5 horse.

A piece that is frozen may not push or pull another piece, but it can be pushed or pulled by another piece.

The b1 camel is frozen and cannot pull the c1 dog.

Equally strong pieces cannot push or pull each other.

The dogs on g2 and h2 cannot pull each other.

Rabbits can be pulled backwards but they cannot move backwards voluntarily.

Relationship Between Pushing and Pulling
A piece may not push and pull simultaneously. The player may use the four steps of his or her turn to perform one push or pull followed by another push or pull.

In Figure 6, the Silver camel can push the f2 rabbit to e2 but it cannot use a third step to pull the h2 rabbit to g2. The Silver camel may:
 * use four steps to push the f2 rabbit to e2 and then to d2.
 * use four steps to pull the h2 rabbit to g2 and then to g3.
 * use four steps to pull the h2 rabbit to g2 and then push it to g1.

Special Cases with Pushing and Pulling
Rabbits can be pushed or pulled backward but they cannot move backward voluntarily.

All steps must always be into an unoccupied square, including steps that are part of a push or pull. If there are no empty squares next to a weak piece, that piece cannot be pushed even if pushing it would otherwise be legal. If there are no empty squares next to a strong piece, that piece cannot pull another piece even if the pull would otherwise be legal.

Relationship Between Freezing, Pushing and Pulling
A frozen piece cannot be moved by the player who owns it. However, a piece's frozenness does not prevent it from being pushed or pulled by the opponent.

Relationship Between Capturing, Pushing, and Pulling
The board has four specially marked trap squares located at c3, c6, f3, and f6. If a piece is on a trap square and it is not next to any friendly pieces it is immediately captured and permanently removed from the game. There are five ways that a piece can be captured:
 * 1) Stepping onto a trap square voluntarily when there are no friendly pieces adjacent to the trap.
 * 2) Being pushed or pulled onto a trap square when there are no friendly pieces adjacent to the trap.
 * 3) Pushing or pulling a weaker piece, leaving the stronger piece on the trap square with no friendly pieces adjacent to the trap.
 * 4) Being on a trap square when the only adjacent friendly piece moves away voluntarily.
 * 5) Being on a trap square when the only adjacent friendly piece is pushed or pulled away.

A push or pull always takes two steps. Both steps are always completed even if one of the steps results in a piece being captured.

Figure 6 illustrates various possible captures.
 * The b6 cat can step voluntarily into the c6 trap.
 * The b7 dog can push the b6 cat into the c6 trap.
 * The b6 cat can step to c6, pulling the Gold rabbit to b6.
 * The e6 horse can push the f6 cat.
 * The g7 dog can push or pull the g6 rabbit.
 * The c3 camel can pull the c2 horse onto the c3 trap.