What is an "endgame tablebase"?
An endgame tablebase exhausts all positions of certain material combinations. The largest one Xiangqi enthusiasts have built so far is probably at the level of Chariot and Cannon vs Horse, Cannon and a full set of Advisors and Elephants. Roughly speaking, that is about 5-6 major pieces, while a complete Xiangqi endgame tablebase would be around 20-plus major pieces.
For example, you first exhaust "King vs General", and on that basis go on to exhaust "King and Pawn vs General", and so on. To build a tablebase for Chariot vs two Horses, you must first have the tablebases for King vs General, King vs Horse, King vs two Horses, King and Chariot vs General, and King and Chariot vs Horse.
A tablebase first enumerates all positions of a material combination, then extracts all the winning positions, then extracts all positions in which the side being checkmated cannot stop the checkmate, and so on, working backward to derive every theoretically won and lost position. Whatever cannot be reached in the end is a draw. It records the win/draw/loss result of every position. If you stop here, it is called an "evaluation library (审局库)". If you then rank all the won and lost positions, so that given a won or lost position the engine can give the best next move, you have a complete endgame tablebase.
Under the tablebase's rules, barring bugs, its conclusions are absolutely accurate. A tablebase has only three conclusions, win, loss and draw. Apart from the number of moves needed for won and lost positions, there are no scores at all.
DTM and DTC
Xiangqi endgame tablebases mainly come in two types, DTM (Depth to mate) and DTC (Depth to conversion).
In DTM, the winning side's goal is only checkmate or stalemate, and the losing side tries to delay checkmate or stalemate as long as possible.
For DTC, we use the cloud database's DTC as the example. The winning side's goal is checkmate, stalemate, or a change in material (including the winner's own piece being captured), whichever is shortest. There is also a special count of repetition violations: the winning side tries to prevent the losing side from violating the repetition rules, and if it cannot, it takes the path with the fewest violations by the losing side and delays those violations. The losing side delays being checkmated, being stalemated, and changes in material, and tries to commit violations.
Note
If no violation count is shown, it does not mean the winning side can truly prevent the opponent from violating the rules. Suppose in some position a Red Elephant is blocking a Black Chariot, and the Black Chariot can capture it and then give perpetual check. The position may still show no violation count, because the losing side prioritizes delaying material change, so in the listed moves the losing side will not capture the Elephant first.
Because DTC targets a shorter number of moves, its size is much smaller than DTM.
Some Xiangqi engines can search together with endgame tablebases in their own format.
The ultimate goal of endgame tablebases is an all-pieces tablebase, which is of course completely impossible at present.
