Previous   Next   Download

MaxQi is now part of the Fairy-Max package, the source code of which you can find in my on-line repository.

A Windows binary is available from here.


A Minimalist XiangQi Engine for WinBoard

MaxQi is a derivative of Fairy-Max, which again is a derivative of the 100-line Chess program micro-Max. Micro-Max has a table-driven move generator, and Fairy-Max expands on this by allowing each move direction to specify the nature of the move (slider, leaper, hopper) as well as a secondary move step (which can be used to implement lame leapers). It could therefore already play all Xiangqi pieces (in XQ Elephants and Horses are lame leapers), but it could not yet play Xiangqi because the board was limited to 8 ranks. Fairy-Max was also lacking the possibility to restrict pieces to a sub-set of the board.

In MaxQi I added these features, as well as the King facing rule. The latter could be implemented cheaply by not really consider it as a King move from one Palace into the other, but is detected during the board scan that hunts for pieces of the side to move. By doing this board scan file by file (by putting the board at 90 degrees compared to the orientation Fairy-Max normally uses), setting a flag if a King of either color is encountered, and clearing that flag on any other piece or at the end of a file, encountering a new King when the flag is set means the side to move wins by King capture.

The board zones are implemented through a board-sized table indicating one board half by setting one bit, and the other board half by setting another (but not in the palaces). Two newly assigned bits in the move rights for each move direction indicate if the move is forbidden to enter a square for which the corresponding bit in this table was set. This can then be used to both prevent Elephants from crossing the river, and Guards and Kings from leaving the palace.


Despite its small size, MaxQi has a pretty advanced search. It is mainly lacking in the area of evaluation: it hardly has more than piece values, and a general attraction to the center for selected pieces. The following features are present:

Alpha-beta search
Quiescence search
Iterative Deepening
Check extension
Late-Move Reductions
Internal Iterative Deepening in every node
Always-replace hash table
No move sorting except first move
Hash move / best of previous iteration / MVV/LVA move seached first
Futility pruning

Most sorely missing are piece-square tables for the evaluation, and killer heuristic in the search. Despite its simplicity, MaxQi seems about equally strong as VSCCP when it plays 20 times faster than the latter.

MaxQi is available in source code. It requires the file qmax.ini to run; this file is a remnant of the fmax.ini of Fairy-Max, but unlike for the latter, now only contains the description of a single variant: Xiangqi.

MaxQi is also available as an AI plugin for the HOXChess interface. In this case it dos not need the qmax.ini file. In stead the move-gnerator tables are initialized at compile tme.

It seems someone mad a UCCI version of MaxQi, but I don't know where that can be downloaded.

Previous   Next