Qianhong

Chinese Chess for Windows


1. Plugin Overview

A Qianhong AI plugin is simply a Windows console program that is capable of reading standard input and writing standard output. Qianhong runs the plugin executable as a detached process with its standard I/O redirected to anonymous pipes. A text-based protocol, which consists of only a handful of simple commands, is used to communicate with the plugin.

As an example, the following text shows the first part of a game against QHPlugin.exe (the default Qianhong AI engine) on a level 3 setting:

LEVEL 3                  (Qianhong sets the AI level)
OK - Set AI level to 3   (Plugin accepts it)
PLAY H2-E2               (Qianhong plays a move: round 1, red)
OK                       (Plugin accepts it)
AI                       (Qianhong asks for AI to move)
B9-C7                    (Plugin plays a move: round 1, black)
PLAY E2-E6               (Qianhong plays a move: round 2, red)
OK                       (Plugin accepts it)
AI                       (Qianhong asks for AI to move)
C7-E6                    (Plugin plays a move: round 2, black)
UNDO                     (Qianhong backs out last move)
OK                       (Plugin accepts it)

That's the basic interface. Now for the details: 2. Plugin Modes.