1) Recommend that directives not needed in protocol two not be supported as they are not necessary if protocol two is being used with SAN and FEN enabled. This eliminates both confusion and effort. When in doubt, dike it out. So, white, black, edit, and maybe several other directives need not be implemented.
2) Establish a minimal set of well-described state variables which the programmer's side of the interface must maintain. For each variable, explicitly state its initial default value. For each directive sent by XBoard, explicitly state which of these variables are changed and how their new values are calculated. Do not allow any single state variable to have more than one meaning; e.g., force mode should be a boolean and be separate from the color played by the program. Parenthetically, the list of state variables should include whatever information is needed for the program to generate PGN tag pairs.
3) To make description of the state variables easier, introduce a Role structure which describes color, name, rating, clock time, and other per-player status. The program should have in its state variable set a two element array of these Role objects, indexed by the constants RoleOppo (the opponent) and RoleSelf (the program).
So, the description for the directive rating would be something like:
RoleVec[RoleSelf].elo = atoi(arg(1));
RoleVec[RoleOppo].elo = atoi(arg(2));
Other directive descriptions like result would be more complex, but that's where the help is most needed.
Symbolic's Role class:
Code: Select all
class RoleDesc
{
public:
RoleDesc(void) {Reset();}
void Reset(void);
private:
friend class XbdCoPro;
Color rolecolor; // Playing color
bool rolecomp; // Computer status
std::string rolename; // Name
ui rolerating; // Rating
Usec roleusec; // Remaining microseconds
};
Code: Select all
ui gamecount; // Number of "result" directives received
bool oneshot; // True if one time post connection performed
std::string icsname; // Internet Chess Server name; "-": local
bool icslocal; // ICS local flag
bool isforce; // Forced mode flag
bool ishard; // Ponder enable flag
bool ispost; // Post enable flag
bool israndom; // Random enable flag
Usec leviusec; // Level: increment microseconds
Usec levpusec; // Level: period microseconds
ui levtcmc; // Level: time control move count
ui limitsd; // Depth limit (ply)
ui limitst; // Time limit: seconds
RoleDesc rolevec[RoleLen]; // Play role indexed data