What is Xiangqi?
Xiangqi (象棋), also called Chinese chess, is a board game on a 9 by 10 grid where Red and Black each move 16 pieces in turn and win by checkmating the enemy general (帥 or 將). A river runs across the middle and each side has a palace, and the way pieces change once they cross the river is what makes the game so distinctive.
Pieces sit on the intersections of the lines, not inside the squares. Red moves first. When your general is attacked you are in check and must answer it at once; if no move can escape, it is checkmate and the game is over. This version plays with the full standard rules, offers easy, normal and hard computer opponents, and lets two people share one screen.
How do the Xiangqi pieces move?
Each side has 1 general, 2 advisors, 2 elephants, 2 horses, 2 chariots, 2 cannons and 5 soldiers, 16 pieces in all. The chariot is the strongest, the horse and elephant are blocked when their path is occupied, and the cannon jumps over exactly one piece only when it captures.
| Piece | Red · Black | Movement | Value |
|---|---|---|---|
| General | 帥 · 將 | One point orthogonally inside the palace. The two generals may not face each other on an open file | none |
| Advisor | 仕 · 士 | One point diagonally inside the palace | 2 |
| Elephant | 相 · 象 | Exactly two points diagonally. Blocked if the midpoint (the elephant's eye) is occupied, and it may never cross the river | 2 |
| Horse | 傌 · 馬 | One point orthogonally, then one point diagonally outward. Blocked if the first point (the horse's leg) is occupied | 4 |
| Chariot | 俥 · 車 | Any distance orthogonally until something is in the way | 9 |
| Cannon | 炮 · 砲 | Moves like a chariot. To capture it must jump over exactly one piece (the screen) and take the first piece beyond it | 4.5 |
| Soldier | 兵 · 卒 | One point forward. After crossing the river it may also move one point sideways. It never moves backward and is never promoted | 1 to 2 |
The values are what the computer uses to judge a position, and a soldier that has crossed the river counts almost double because it can move sideways. Blocking a horse's leg and blocking an elephant's eye are the two classic defensive tricks of the game.
What are the river and the palace?
The band in the middle marked 楚河 漢界 is the river, and the 3 by 3 area with the X at each end is the palace. Elephants cannot cross the river, soldiers must cross it before they can move sideways, and the general and advisors can never leave the palace.
The river is named after the border between the ancient states of Chu and Han. The files look interrupted at the river, but chariots, horses, cannons and soldiers cross it freely. The palace has nine points, and its diagonals are the advisor's paths. A soldier that reaches the enemy palace becomes the cheapest attacker in the game, sliding sideways to squeeze the general.
What are the check rules?
A check must be answered immediately, and you may never make a move that leaves your own general attacked or makes the two generals face each other. If the same position repeats three times and only one side has been giving check the whole time, that side loses.
- No self check: A move that leaves your general under attack is illegal and never appears among the highlighted points.
- Flying general: The two generals may not stand on the same file with nothing between them. In effect a general attacks like a chariot along the file, which makes it a real weapon in the endgame.
- Perpetual check: When a position appears for the third time, the side whose every move in between was a check loses. If neither side or both sides were checking, it is a draw.
- Stalemate loses: A side with no legal move loses even when it is not in check, unlike Western chess where stalemate is a draw.
- Draws: 120 plies without a capture, or neither side having a chariot, horse, cannon or soldier left, ends the game as a draw.
How is Xiangqi different from Korean Janggi?
The board size and piece count are the same, but Xiangqi has a river, its general cannot move diagonally, its cannon only jumps when capturing, and its elephant moves two points diagonally. Playing both makes the differences obvious. You can also play Janggi against the computer here.
| Item | Xiangqi (Chinese) | Janggi (Korean) |
|---|---|---|
| Board | River in the middle, files interrupted | No river, all lines continuous |
| General | Orthogonal step in the palace, generals may not face each other | Orthogonal or diagonal step in the palace, facing is allowed |
| Advisor | Diagonal step only | Orthogonal or diagonal step like the general |
| Elephant | Two points diagonally, cannot cross the river | One orthogonal then two diagonal, anywhere on the board |
| Cannon | Moves like a chariot, jumps one piece only to capture. Can jump and take cannons | Must jump even to move, cannot jump or take another cannon |
| Soldier | Sideways only after crossing the river | Forward or sideways from the start |
| Setup | Fixed (chariot, horse, elephant, advisor, general) | Players choose one of four horse and elephant arrangements |
| No legal move | That side loses | Draw, or the side passes |
| Pieces | Round discs with characters | Octagons of different sizes |
How strong are the computer levels?
Easy looks two plies ahead and deliberately mixes in shaky moves, normal looks four plies ahead, and hard reads as far as it can within one second, usually five to seven plies. All three avoid moves that would lose by perpetual check.
The engine uses alpha beta pruning with iterative deepening and keeps examining captures until the position is quiet. Hard thinks on a separate worker thread, so the screen never freezes while it calculates. On the first screen you can choose to play Red (moves first) or Black (moves second); choosing Black flips the board so your pieces are at the bottom. Wins, losses and draws are kept per level in this browser.
Tips for Xiangqi beginners
- Open with the central cannon. Moving a cannon to the central file (the famous 當頭炮) threatens the central soldier and starts the attack fastest. The usual reply is to jump a horse to defend it.
- Get the chariots out early. A 9 point chariot stuck in the corner wastes everything your cannons and horses are doing. Jump a horse first to open a path for the chariot.
- Watch the horse's leg. A piece placed right next to an enemy horse stops it jumping that way. Do not park your own soldiers on the points your horse needs.
- Steal the cannon's screen. A cannon with nothing to jump over cannot capture. Remove the middle piece on the line it aims along, or give your own cannon a screen to create a threat.
- Soldiers double across the river. A sideways moving soldier is the cheapest way to squeeze the enemy palace, but soldiers that have not crossed are easy to lose, so do not push them carelessly.
- Use the flying general. In the endgame, put your general on the same file as the enemy general and the piece between them is pinned. Half of all checkmate patterns come from this.
Controls
- Phone and mouse: Tap a piece to lift it and show its reachable points, then tap a point to place it. You can also drag and drop. Capturable pieces get a red ring.
- Keyboard: Arrow keys or WASD pick a point, Enter or Space picks up or places a piece, Esc cancels and Ctrl+Z undoes.
- Undo: Against the computer it takes back your move and the computer's reply together; in two player mode it takes back the last move.
- Sound: The speaker button at the top right toggles the wooden piece sounds. The setting is saved in your browser.
The pieces use the traditional Chinese characters (Red 帥仕相俥傌炮兵, Black 將士象車馬砲卒). The board and pieces are drawn entirely in code; only your records and settings are stored in this browser and nothing is sent to a server.