Xiangqi Analysis Board: Set Up Any Position and See the Best Move

This is a xiangqi (Chinese chess) board you can arrange freely. Set up the position you are curious about, press Ask the AI, and the engine names the best move, says who stands better and shows the line it expects. From there you can play that move and ask again for the reply, or play the position out against the computer. It suits an endgame study you cannot crack, a moment from your own game, or a move in a game record you want to test.

Setting up a position

On a computer the piece box sits to the right of the board: Red in the left column, Black in the right, and Remove at the bottom. Click a piece in the box, then a point on the board, and it is placed; keep clicking to place more of the same, and click a piece of that kind again to take it off. On a phone the box is laid out right under the board.

  • With nothing chosen in the box, click a piece on the board and then another point to move it there.
  • With Remove on, each piece you click comes off the board.
  • Clear leaves only the two kings, a clean start for an endgame; Start restores the opening position.
  • To move sets whose turn it is. The same position can be won with one side to move and lost with the other.

Each side has one king, so placing a king from the box moves the one already on the board.

Reading the answer

The answer has three parts. The best move is written in WXF notation such as H7+8, and marked on the board: the piece is lifted and a green ring shows where it lands. Next to it is the verdict, "About even", "Red is better", "Red is winning", or a forced mate such as "Red mates in 3". Under both is the line, up to six moves that the two sides are expected to play.

In WXF a move is a piece letter, the file it stands on, a direction and a destination. Files are numbered 1 to 9 from each player's own right. A plus sign moves forward, a minus sign moves back and an equals sign moves sideways. So H7+8 is the horse on file 7 advancing to file 8, and C1=9 is the cannon on file 1 sliding across to file 9. Each piece goes by one letter: K for the king, A and E for the advisor and the elephant, H for the horse, R for the chariot, C for the cannon and P for a pawn.

Play it makes the best move on the board and hands the turn to the other side, so asking again gives the reply. Play from here starts a game from the position: you take the side to move, the computer takes the other, and Back to set-up returns to editing at any point.

Asking Pikafish

The page starts with a small engine that is ready almost at once. When an answer is on screen, Ask Pikafish downloads the Pikafish engine, about 51 MB, runs the same position again, and keeps using it for the rest of your visit. Pikafish is an open-source xiangqi engine derived from the chess engine Stockfish.

Pikafish only accepts positions that could come up in a real game. Three chariots, six pawns, an advisor off the palace diagonals, an elephant across the river or a pawn behind its starting row are all beyond it, and the button is switched off with a note saying why. The small engine has no such limit and still gives a move.

Positions the engine cannot take

There are three, and the status line says which one applies:

  • A side does not have exactly one king, or a king is outside its own palace.
  • The kings face each other on one file with nothing between them.
  • The side that is not to move is in check. If a red chariot already attacks the black king and Red is set to move, switch To move to Black.

When the side to move is already checkmated or has no legal move, the page says so itself.

Sharing a position

Copy link writes the position into the address, and anyone who opens it sees the same board. The address in the browser follows the board as you edit, so a bookmark brings the same position back.

Do I need to install anything or sign in?

No. The engine runs in your own browser, the position is not sent to a server, and there is no account. The browser fetches the engine once after the page opens, and a later visit can usually reuse it.

Does it work on a phone?

Yes. The board fills the screen, the pieces are right under it, and placing works by tapping a piece and then a point; To move, Clear, Start and Copy link are behind the settings button in the corner of the piece box. Pikafish is a 51 MB download, so think twice on mobile data; the small engine is light.

Can I use it to check a xiangqi puzzle?

Yes. Copy the puzzle onto the board, set the right side to move and ask. For a mating puzzle the verdict gives the number of moves and the line is one way to deliver it, and Play it steps through the solution. For practice there are more than 3,400 checkmate puzzles sorted by pattern, each set starting with mates in one, and a full game is on the Xiangqi play page.

Pictorial pieces by Xiangqi.com