# Rules of play

**Version:** v001 — Hierarchical Piece Sizing

This document completely describes how to play this version of the game.
A reader with only this document and the interface can play a full game
against another player, and the two of them can determine who won.

## The game

Chess. Two players, White and Black, on an 8×8 board of alternating
light and dark squares. Each player begins with sixteen pieces arranged
on their two nearest ranks: eight pawns on the second rank; rook,
knight, bishop, queen, king, bishop, knight, rook on the first, with the
queen on her own color (White's queen on d1, Black's on d8).

White moves first. Players alternate, one move per turn. Passing is not
allowed.

## Objective

Checkmate the opposing king: attack it such that the opponent has no
legal move that removes the attack. Delivering checkmate wins the game
immediately.

## Piece movement

- **Pawn** (circle): moves one square straight forward to an empty
  square; from its starting square it may instead move two squares
  forward if both are empty. It captures diagonally forward one square.
  It never moves backward.
- **Knight** (L shape): moves in an "L" — two squares in one rank/file
  direction and one square perpendicular. It jumps over intervening
  pieces.
- **Bishop** (triangle): moves any number of empty squares diagonally.
- **Rook** (square): moves any number of empty squares along a rank or
  file.
- **Queen** (asterisk): moves any number of empty squares along a rank,
  file, or diagonal.
- **King** (cross): moves one square in any direction.

A piece captures by moving onto a square occupied by an enemy piece,
which is removed. No piece except the knight may pass through occupied
squares. You may never capture your own piece.

## Special moves

- **Castling:** the king moves two squares toward one of its rooks and
  that rook moves to the square the king crossed. Allowed only if
  neither the king nor that rook has moved, the squares between them are
  empty, the king is not in check, and the king does not cross or land
  on an attacked square.
- **En passant:** immediately after an enemy pawn advances two squares
  and lands beside your pawn, your pawn may capture it as if it had
  advanced only one. Available only on the very next move.
- **Promotion:** a pawn reaching the last rank becomes, at its owner's
  choice, a queen, rook, bishop, or knight. The interface presents the
  choice when it occurs.

## Check and legality

A king is **in check** when an enemy piece attacks its square. You may
never make a move that leaves your own king in check; the interface
enforces this by only permitting legal moves. If you are in check, every
legal move available to you resolves the check.

## How a game ends

The interface detects each of these conditions automatically and
announces the result in the status line. That announcement is the
authoritative verdict.

**Decisive results:**

- **Checkmate.** The player to move is in check and has no legal move.
  That player loses; the other player wins.

**Draws (neither player wins):**

- **Stalemate.** The player to move is not in check but has no legal
  move.
- **Fifty-move rule.** Fifty consecutive full moves pass with no capture
  and no pawn move.
- **Threefold repetition.** The same position, with the same player to
  move and the same castling and en-passant rights, occurs for the
  third time.
- **Insufficient material.** Neither side retains enough material to
  ever deliver checkmate (for example, king against king, or king and
  one minor piece against king).

## Determining the winner

Play until the status line announces a result. "Checkmate — White wins"
or "Checkmate — Black wins" names the winner. "Stalemate" or "Draw"
means neither player has won. There is no interpretation involved in
this version: the verdict is computed from the rules above and displayed.

## The interface

Move by dragging a piece to a highlighted destination, or by clicking a
piece and then clicking a destination. Legal destinations are marked
when a piece is selected. **New game** starts over; **Undo** takes back
the most recent move by agreement of the players. The game is local:
both players share one screen and take turns with the same pointer.
