Fox Go AI Protocol
Fox Go AI Protocol
Version:1.05
Date:2022-06-06
Company:Beijing Wild Fox Century Technology Co., Ltd
Home Page:https://www.foxwq.com
Email: foxwq@foxwq.com
Version History:
Date Version Editor Description
20161207 1.02 Zhang Weifang Complete description. Increase the official email.
1 / 9
1 Communication Model
FOX TCP AI
This Protocol
Controller GTP
Client Engine
The Fox Go client does not support the GTP protocol to communicate directly with the AI
engine. It must be through a controller for transit. The Fox Go client connects to the controller
through TCP and uses this protocol to communicate with the controller.
In order to facilitate the description described later, the text referred to as Controller AI, the
text appears in all AI refers to the Controller. FOX appears in the text refers to the Fox Go client.
Note: It is recommended to use the FoxGTP program provided by Fox Go.
2 Interaction
When connected to the AI in a non-game state, the $FASTATUS command gives the current
nog-game state.
2 / 9
2.1.3 The New Game Starts
When in the game state, the $FAMOVE command gives the last move, including whether it is
AI turn, the color of AI, and the move information(index, coordinates, color).
If the current turn to AI play, AI need to use the command $AFPLAY notify FOX to put stone,
or use the command $AFSKIP notify FOX to pass.
Use the $AFGIVEUP command to give up, regardless of whether the AI is currently in turn.
When in the game state, the $FASKIP command gives pass information, including whether it
is AI turn, and the color of AI.
If the current turn to AI play, AI need to use the command $AFPLAY notify FOX to put stone,
or use the command $AFSKIP notify FOX to pass.
Use the $AFGIVEUP command to give up, regardless of whether the AI is currently in turn.
When in the game state, the remaining time information of the current game is given by the
$FATIMELEFT command when the main time elapses or the remaining number of Byo yomi times
decreases.
When the game ends, the $FARESULT command gives the current game result information.
2.6 AI Play
When the AI receives $FAMOVE or $FASKIP, if the state is the current turn to AI, you can use
the command $AFPLAY for playing stone, the command must contain the color of AI, and the
3 / 9
move information.
2.7 AI Pass
When the AI receives $FAMOVE or $FASKIP, if the state is the current turn to AI, you can use
the command $AFSKIP for passing, the command must contain the color of AI.
2.8 AI Give Up
When in the game state, at any time AI can use the $AFGIVEUP command to give up, the
command must contain the color of AI.
When in the game state, at any time AI can use the $AFSTATUS command to query the current
state of the game, the command must contain the color of AI.
Use the command $FASCORE to request a calculated score from the AI. The AI gives the
calculated score using the command $AFSCORE.
3 Communication Protocol
Format Description:
◼ The packet begins with $, followed by the packet command character, ending with
<CR><LF>.<CR> refers to the carriage return value of ‘\r’, <LF> refers to
a newline value of ‘\n’.
◼ *hh before <CR><LF> is the check byte. * is a fixed symbol. hh is
hexadecimal character (not case-insensitive). The value of hh is the
exclusive OR of all characters between $ and * (excluding the characters
$ and *)(see Appendix A for checksum C++ code).
◼ The contents of the packet are separated by commas (,). There is no limit to the number of
content items in a packet. Content items need to be resolved according to specific commands.
4 / 9
3.2 Commands
$AFSTATUS AI->FOX Notify FOX query the state of the game 1.00
Description: AI->FOX Notify FOX query the state of the game. the results will be reported to AI by
$FASTATUS command.
Format: $AFSTATUS,W*hh<CR><LF>
Analysis:
⚫ $AFSTATUS is the name of the command.
⚫ The content item 1 represents the current AI color, B represents Black, W represents White.
8 / 9
Appendix A
BOOL FOXPKG_CalCheckSum(
IN const BYTE *pDataBuf, // 数据缓冲区
IN DWORD dwcbBufSize, // 缓冲区字节大小
OUT BYTE &byteCheckSum // 带出校验和
)
{
// 参数有效性
if (pDataBuf==NULL || dwcbBufSize==0)
{
return FALSE;
}
// 计算异或和的值
BYTE checkSum = pDataBuf[0];
for (DWORD i=1; i<dwcbBufSize; i++)
{
checkSum ^= pDataBuf[i];
}
// 输出结果
byteCheckSum = checkSum;
return TRUE;
}
9 / 9