# Heian shogi

Heian shōgi (平安将棋, "Heian era shogi") is a predecessor of modern shogi. Some form of the game of Chaturanga, the ancestor of both chess and shogi, reached Japan by the 9th century, if not earlier, but the earliest surviving Japanese description of the rules dates from the early 12th century (c. 1120, during the Heian period). This description does not give enough information to actually play the game, but this has not stopped people from attempting to reconstruct this early form of shogi.

## Rules of the game

Piece movements were as in modern shogi, but there was no rook or bishop. The board appears to have been 9×8 or 8×8. The setup is unknown, but can reasonably be assumed to have been the same as in modern shogi (minus the rook and bishop, and minus a gold general in the 8×8 case), although it's possible that the pawns started on the second rank rather than the third. It can safely be assumed that the game was played without drops. This article outlines a fairly complete set of rules that can make the game playable in modern times.

### Objective

The objective of the game is to either capture your opponent's king or all the other pieces.

### Game equipment

Two players, Black and White (先手 sente and 後手 gote), play on a board ruled into a grid of 8 or 9 ranks (rows) by 8 or 9 files (columns). The squares are undifferentiated by marking or color.
Each player has a set of 16 or 18 wedge-shaped pieces, of slightly different sizes. From largest to smallest (most to least powerful) they are:
* 1 king
* 1 or 2 gold generals
* 2 silver generals
* 2 knights
* 2 lances
* 8 or 9 pawns
Most of the English names were chosen to correspond to rough equivalents in Western chess, rather than as translations of the Japanese names.
Each piece has its name in the form of two kanji written on its face. On the reverse side of some pieces are two other characters, often in a different color (commonly red instead of black); this reverse side is turned up to indicate that the piece has been promoted during play. The pieces of the two sides do not differ in color, but instead each piece is shaped like a wedge, and faces forward, toward the opposing side. This shows who controls the piece during play.

#### Table of pieces

Listed here are the pieces of the game with their Japanese representation.
| Piece | Kanji | Rōmaji | Unicode | Abbreviation | Meaning |
| King | 玉将 | gyokushō | 7389 5c06 | 玉 | jade general |
| Gold general | 金将 | kinshō | 91d1 5c06 | 金 | gold general |
| Silver general | 銀将 | ginshō | 9280 5c06 | 銀 | silver general |
| Knight | 桂馬 | keima | 6842 99ac | 桂 | laureled horse |
| Lance | 香車 | kyōsha | 9999 8eca | 香 | incense chariot |
| Pawn | 歩兵 | fuhyō | 6b69 5175 | 歩 | foot soldier |
Silver generals and gold generals are commonly referred to simply as silvers and golds, parallel to their abbreviations in Japanese.
The characters inscribed on the backs of the pieces to indicate promoted rank may be in red ink. All pieces except the king and gold general promote to gold.

### Setup

Below is the board setup for a 9x8 board. Different possible boards, of size 8x9 or 8x8, can be obtained from this size board by removing the e-row (五-row), the sixth column, or both.
| 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | |
| 香 車 | 桂 馬 | 銀 将 | 金 将 | 玉 将 | 金 将 | 銀 将 | 桂 馬 | 香 車 | 一 |
| | | | | | | | | | 二 |
| 歩 兵 | 歩 兵 | 歩 兵 | 歩 兵 | 歩 兵 | 歩 兵 | 歩 兵 | 歩 兵 | 歩 兵 | 三 |
| | | | | | | | | | 四 |
| | | | | | | | | | 五 |
| 歩 兵 | 歩 兵 | 歩 兵 | 歩 兵 | 歩 兵 | 歩 兵 | 歩 兵 | 歩 兵 | 歩 兵 | 六 |
| | | | | | | | | | 七 |
| 香 車 | 桂 馬 | 銀 将 | 金 将 | 玉 将 | 金 将 | 銀 将 | 桂 馬 | 香 車 | 八 |
| 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | |
| L | N | S | G | K | G | S | N | L | a |
| | | | | | | | | | b |
| P | P | P | P | P | P | P | P | P | c |
| | | | | | | | | | d |
| | | | | | | | | | e |
| P | P | P | P | P | P | P | P | P | f |
| | | | | | | | | | g |
| L | N | S | G | K | G | S | N | L | h |
Each side places his pieces in the positions shown below, pointing toward the opponent.
* In the rank nearest the player:
** The king is placed in the center file or left of center.
** The two gold generals are placed in the adjacent files to the king or one to its right.
** The two silver generals are placed adjacent to each gold general or gold general and king.
** The two knights are placed adjacent to each silver general.
** The two lances are placed in the corners, adjacent to each knight.
That is, the first rank is |L|N|S|G|K|G|S|N|L| or |L|N|S|K|G|S|N|L|.
* In the third rank, the eight or nine pawns are placed one in each file.

### Game play

The players alternate making a move, with Black moving first. (The traditional terms 'black' and 'white' are used to differentiate the sides during discussion of the game, but are no longer literally descriptive.) A move consists of moving a single piece on the board and potentially promoting that piece or displacing (capturing) an opposing piece.

### Movement and capture

An opposing piece is captured by displacement: That is, if a piece moves to a square occupied by an opposing piece, the opposing piece is displaced and removed from the board. A piece cannot move to a square occupied by a friendly piece (meaning another piece controlled by the moving player).
Each piece on the game moves in a characteristic pattern. Pieces move either orthogonally (that is, forward, backward, left, or right, in the direction of one of the arms of a plus sign, +), or diagonally (in the direction of one of the arms of a multiplication sign, ×). The knight is an exception in that it does not move in a straight line.
If a lance or pawn, which cannot retreat or move aside, advances across the board until it can no longer move, it must be promoted upon reaching the farthest rank. This also applies to the knight upon reaching either of the two farthest ranks.
The movement categories are:

#### Step movers

Some pieces move only one square at a time. (If a friendly piece occupies an adjacent square, the moving piece may not move in that direction; if an opposing piece is there, it may be displaced and captured.)
The step movers are the king, gold general, silver general and pawn.

#### Jumping piece

The knight can jump, that is, it can pass over any intervening piece, whether friend or foe, with no effect on either.

#### Ranging piece

The lance can move any number of empty squares along a straight line, limited only by the edge of the board. If an opposing piece intervenes, it may be captured by moving to that square and removing it from the board. A ranging piece must stop where it captures, and cannot bypass a piece that is in its way. If a friendly piece intervenes, the moving piece is limited to a distance that stops short of the intervening piece; if the friendly piece is adjacent, it cannot move in that direction at all.

#### Individual pieces

Below are diagrams indicating each piece's movement. Betza's funny notation has been included in brackets for easier reference.
    ○ - Steps to a square.
    ☆ - Leaps to a square (jumping over any intervening piece).
    │ - Ranging movement (may cross any number of empty squares).
| King | King | Gold General | Gold General |
| Step: The king can step one square in any direction, orthogonal or diagonal. (K) | ○○○   ○玉○   ○○○ | Step: The gold general can step one square in one of the four orthogonal directions; or, one square diagonally forward, giving it six possibilities. (WfF) | ○○○   ○金○    ○ |
| Silver General | Silver General | Knight | Knight |
| Step: The silver general can step one square in one of the four diagonal directions; or, one square straight forward, giving it five possibilities. (FfW) | ○○○    銀    ○ ○ | Jump: The knight jumps at an angle intermediate between orthogonal and diagonal, amounting to one square forward plus one square diagonally forward, in a single motion, ignoring any intervening piece. That is, it has a choice of two forward destinations. (ffN) A knight that reaches one of the two farthest ranks must promote. | ☆ ☆          桂 |
| Lance | Lance | Pawn | Pawn |
| Range: The lance can move any number of free squares straight forward. (fR) A lance that reaches the farthest rank must promote. | │     │     香 | Step: The pawn can step one square forward. (fW) A pawn that reaches the farthest rank must promote. | ○     歩 |

### Promotion

A player's promotion zone consists of the three farthest ranks, at the original line of the opponent's pawns and beyond (that is, the opponent's territory at setup). If a piece crosses the board within the promotion zone, including moves into, out of, or wholly within the zone then that player may choose to promote the piece at the end of the turn. Promotion is effected by turning the piece over after it moves, revealing the name of its promoted rank.
Promoting a piece has the effect of changing how that piece moves until it is removed from the board. Each piece promotes as follows:
* A king or a gold general cannot promote, nor can pieces which are already promoted.
* A silver general, knight, lance or pawn, when promoted, loses its normal movement and gains the movement of a gold general.
If a pawn, knight or lance reaches the farthest rank, it must be promoted, since it would otherwise have no legal move on subsequent turns. For the same reason, a knight reaching the last-but-one rank must be promoted.

### Check and mate

When a player makes a move such that the opponent's king could be captured on the following move, the move is said to give check to the king; the king is said to be in check. If a player's king is in check and no legal move by that player will get the king out of check, the checking move is also mate, and effectively wins the game.
A player is not allowed to give perpetual check.

### Game end

A player who captures the opponent's king or all of the other pieces (bare king) wins the game. In practice this rarely happens, as a player will resign when checkmated, as otherwise when loss is inevitable.
A player who makes an illegal move loses immediately. (This rule may be relaxed in casual games.)
There are two other possible (but fairly uncommon) ways for a game to end: repetition (千日手 sennichite) and impasse (持将棋 jishōgi).
If the same position occurs four times with the same player to play, then the game is no contest. (Recall, however, the prohibition against perpetual check.)
The game reaches an impasse if both kings have advanced into their respective promotion zones and neither player can hope to mate the other or to gain any further material.

## Game notation

The method used in English-language texts to express shogi moves was established by George Hodges in 1976. It is derived from the algebraic notation used for chess, but differs in several respects.
A typical example is P-8f. The first letter represents the piece moved: P = pawn, L = lance, N = knight, S = silver, G = gold, K = king. Promoted pieces have a + added in front of the letter. e.g., +P for a tokin (promoted pawn). The designation of the piece is followed by a symbol indicating the type of move: - for an ordinary move or x for a capture. Next is the designation for the square on which the piece lands. This consists of a number representing the file and a lowercase letter representing the rank, with 1a being the top right corner (as seen from Black's point of view) and 8h or 9h being the bottom left corner. (This method of designating squares is based on Japanese convention, which, however, uses Japanese numerals instead of letters. For example, the square 2c is denoted by 2三 in Japanese.)
If a move entitles the player to promote the piece, then a + is added to the end to signify that the promotion was taken, or an = to indicate that it was declined. For example, Nx7c= indicates a knight capturing on 7c without promoting.
In cases where the above notation would be ambiguous, the designation of the start square is added after the designation for the piece in order to make clear which piece is meant. For example, in the initial position Black may have two golds which can be moved to the square 5g in front of the king, and these are distinguished as G6h-5g (moving the left one) and G4h-5g (moving the right one).
Moves are commonly numbered as in chess. For example, the start of a game might look like this: