Complete Implementation of WXF Chinese Chess Rules
Daniel Tan, Neftali Watkinson Medina
TL;DR
This work tackles the complexity of repetition outcomes under World Xiangqi Federation (WXF) rules in Xiangqi, where repetitions can yield win, loss, or draw. It presents a complete algorithm that covers all 110 WXF diagrams, supported by data structures for position history, protected pieces, chasing detection, and a multi-class repetition verdict, augmented with speedups designed for alpha-beta negamax engines. The main contributions include 100% accuracy on the diagram set, a measurable playing-strength gain (+10 Elo after retraining NNUE-style evaluation), and practical applicability as an online referee or AI agent. The results demonstrate that a fully correct repetition-rule implementation is feasible without sacrificing performance, enabling more reliable online play and more robust self-learning Xiangqi engines.
Abstract
Unlike repetitions in Western Chess where all repetitions are draws, repetitions in Chinese Chess could result in a win, draw, or loss depending on the kind of repetition being made by both players. One of the biggest hurdles facing Chinese Chess application development is a proper system for judging games correctly. This paper introduces a complete algorithm for ruling the WXF rules correctly in all 110 example cases found in the WXF manual. We introduce several novel optimizations for speeding up the repetition handling without compromising the program correctness. This algorithm is usable in engines, and we saw a total increase in playing strength by +10 point rating increase, or an increased 5% winrate when integrating this approach into our prototype engine.
