Where this sits in the tradition

Xiangqi problem composition is the older tradition. The earliest known problem, Two Dragons Leave the Sea, is in a Southern Song encyclopedia dated to 1266. The classical manuals followed: a Ming collection of 550 problems in 1570, The Secret in the Orange in 1632, then the Qing collections, one of which (1801) holds the famous street problems such as Seven Stars Gathering (a history of the manuals).

What runs through all of them is a fixed goal. Each problem names its result, a win or a draw, and the solver plays the losing side as well as it can be played. The Ming problems are nearly all wins; the Qing ones are mostly draws. The tradition grew by varying the position, generation after generation, rather than by varying what the solver is asked to do.

Western composition went the other way: it kept the board and changed the goal. Max Lange published the first helpmate in 1854, with White moving first and more than one solution; Sam Loyd's of 1860 was the first with Black to move, and A. Barbe's of 1861 the first with a single solution (the genre's history). Selfmates, series movers and the rest came the same way. The helpmate is now the largest single section of the FIDE Album, the official anthology of the best problems: 2,539 of the 9,218 entries for 2010 to 2012 (FIDE).

Henry Forsberg, 1935. The solution is 1. Qf6 Nc5 2. Qb2 Ra4 mate: the black queen walks to b2 to block its own king's last square, and the white rook mates. The problem is famous for its twins: put a rook, bishop, knight or pawn on a6 instead of the queen and each has its own single solution, five mates from one diagram.

Shogi took the idea from chess too. Its problemists call it bakazume, the cooperative mate: both sides work together to mate the defending king in the fewest moves, and, as in shogi's ordinary mating problems, the attacker moves first (in chess the mated side usually does), normally has no king on the board, and the defender holds every piece not in play. Fairy shogi problems with this goal were being published by the 1960s; in 1970 Kato Tetsu published one 163 moves long, and in 1971 the magazine Tsume Shogi Paradise began a regular series of them (Japanese Wikipedia).

9a8b7c6d5e4f3g2h1i玉龍香Defender holds every other pieceAttacker holds nothing
Cooperative mate in three, attacker first. The attacker, playing up the board, has a dragon on 3d, the red piece: a promoted rook, it moves as a rook or one square diagonally. The defender, whose pieces point down the board, has a king on 2b and a lance on 2e, which moves any distance straight ahead.
9a8b7c6d5e4f3g2h1i龍玉香Defender holds every other pieceAttacker holds nothing
The dragon takes the lance on 2e with check, the king steps to 1c, and the attacker drops the captured lance on 1d. The dragon guards 1d and the whole 2-file, and the lance sees through the king to 1b.

The example on Japanese Wikipedia's page shows what the cooperative goal changes. Dropping the lance farther from the king on the 1-file looks just as good, but then the defender, who holds every spare piece, can drop one in between. An ordinary shogi problem discounts an interposition that is simply captured; a cooperative one counts it, so only 1d mates in three. Our search of the position agrees: it is the only cooperative mate in three, and there is none in one.

We have not found a xiangqi helpmate older than ours. Web searches in Chinese for the names chess problemists give the helpmate turned up chess problems and ordinary xiangqi mating patterns, never a cooperative xiangqi problem, and the classical manuals all ask for a win or a draw. If you know of an earlier one, tell us.

Composing them

The generator is the naive half of this work, and it is worth saying so plainly. A position maker deals diagrams blind, either every placement of a few pieces or random armies from a profile that fixes how much material each side gets. The solver walks every cooperative line of two moves a side, Black first, and keeps a diagram only if exactly one line mates. Nothing in the generator knows what a good problem is: it aims at no theme, prefers no quiet move over a capture, and has no sense of economy. The profiles that gave Black an army and Red one or two pieces produced most of what is worth looking at.

for each diagram the position maker deals:
    # every placement, or random armies from a profile
    if the diagram is illegal: discard
    lines = every Black, Red, Black, Red line that mates
    if len(lines) != 1: discard   # sound: exactly one
    keep (diagram, lines[0])      # 1,470 kept

# final picture: the mater and its square, the
# general's square, what covers each escape
group the kept problems by their final picture
keep one per group                # 186

re-prove each one, counting a general with no legal
move as mated, and requiring no mate in one
                                  # 164 stand
The pipeline, in outline.

This is the floor, and there is a lot of room above it. A composer starts from an idea and builds the position around it, and a search can work the same way. It could start from the mate it wants, say a cannon mating over a black screen, and unwind it to positions two moves earlier instead of dealing until one turns up. It could take a good problem and change it a piece at a time, keeping the changes that make the right first move harder to see or leave less red material idle. It could score what a solver feels: how many of Black's first moves look as natural as the right one, and whether the key move is a quiet one. Or it could skip dealing entirely. Chess composers now have exhaustive helpmate tables, complete through five pieces, that list every sound helpmate for a given material and leave a search only the choosing; we did not build one for xiangqi. Each of these would find problems ours cannot.

Results

The search found 1,470 sound helpmates. Most were the same mate reached from a different setup, often a spectator piece one square over, so we grouped them by the final picture. That left 186 distinct mates. The re-proof then removed 22, for a reason covered below, and 164 stand.

Of the 164, 39 are pure mates, where no square around the mated general is covered twice, and 19 are model mates: pure, with every red piece on the board doing work.

Mate delivered byProblems
Soldier58
Chariot50
Horse28
Cannon28
The 164 problems that stand, by the red piece that gives the final check.

The best ten

Ten problems, one idea each. All 164 are in the study, these ten first and the rest in ranked order. Every one is the slice we searched: Black, Red, Black, Red, and Red's second move mates.

Red has a general and one soldier against seven black pieces, a chariot and both advisors among them. Find the square where a lone soldier can mate, then ask which black piece has to wall the general in.

Red has a general and a horse already in Black's camp; Black has twelve pieces. Black has 45 legal first moves, and exactly one of them leads to mate.

A single red cannon against fifteen black pieces. A cannon cannot check without a screen, so look at which black piece can provide one.

A red chariot against twelve, with Black's back rank already thinned out. The question is which squares beside the black general need filling, and by what.

A general and a horse against twelve again, the horse this time on h8, near a black chariot in the corner. The horse needs both of Red's moves.

The fullest board of the ten: three red soldiers deep in Black's half against fourteen black pieces.

Six pieces: a general, cannon and soldier for Red, a general, cannon and horse for Black. Look at what the red cannon on e5 needs before it can give check.

Black's general is already out of its back rank, with Red's soldier and cannon stacked on the g-file. Red's last move here does two jobs.

Black has two chariots, a horse and a cannon on an open board, and 55 legal first moves. Red has one horse.

A general and one soldier against twelve, the soldier already on f8 beside Black's palace. Black's own pieces have to finish the cage.

What we learned

Xiangqi decides what counts as sound. A general with no legal move has lost, so a helpmate can also end with the losing side not in check and simply nothing to play. Our composer tested only for checkmates. Re-proved under the real rule, 22 of the 186 had other lines it could not see, from 3 to 64 of them, and two could be mated in one. A soundness test ported from chess brings chess's idea of a finished game with it.

The palace makes the lopsided problems possible. A xiangqi general never leaves its nine-point palace and has at most four squares to step to, so a couple of black moves can wall it in. That fits what the search turned up: the profiles with a black army against one or two red pieces produced most of the good problems, because Black does nearly all the building and Red only has to arrive. A chess king has the whole board and up to eight squares, and a helpmate there spends far more of its moves taking them away.

The cannon is the theme chess cannot have. It checks by jumping exactly one piece, and in a helpmate the mated side is cooperating, so Black can supply the screen. Nineteen of the 164 mate over a black screen. The facing-generals rule adds another: the red general can take squares from its own palace, as in the seventh problem.

Finding sound problems is the easy part. The search turned up 1,470 sound helpmates, and most were the same mate from a different setup: grouped by the final picture they came to 186. Soundness is a yes or no that a solver can check. Whether a problem is worth setting up for a friend is not, and nothing in this pipeline measures it. That is the gap the next generator has to close.

What is left to find

We searched one corner of the genre, and the rest is open. Longer helpmates first. Our search found almost no sound helpmates in three: a third move gives both sides many more ways to reach the same mate, so a generator has to aim at unique lines rather than deal and filter. How long can a sound xiangqi helpmate be: ten moves, twenty, a hundred? And can a search prove that a long one is the shortest of its kind, or that its line is the only one?

More impossible-looking ones: the weakest red force against the most black, a lone soldier mating a full army. And the other shapes of the genre: Red moving first, and Red as the side that is mated. We have not searched either. If you find one, or a longer or stranger one than ours, we would love to see it: put it in the forum, or write it up on your own blog and tell us where.

What the slice already shows is that xiangqi does take helpmates, and they are not chess problems on a different board. The rules that make xiangqi what it is, the loss without a legal move, the cannon's screen, the facing generals, decide which problems are sound and how the best of them mate. A good one looks impossible because Red has almost nothing. It works because Black's army is the material the mate is built from: the walls, the screen, the squares filled in around its own general. That is the hope behind this work: to carry the genres Western composers invented onto the xiangqi board, find what is beautiful in them here, and in time find a helpmate good enough to make a xiangqi player stop and set it up for a friend.

Solve all 164The longest forced mates