Communication Protocol (CSA Format 1998)


(1) Command

(a) Move:

Turn:: Sente(Black) for "+" , Gote(White) for "-"
Source Square:: x y coordinate
Destination Square:: x y coordinate
Piece Name after move::
Before promotion After promotion
Fu(Pawn): FU TO
Kyo(Lance): KY NY
Keima(Knight): KE NK
Gin(Silver): GI NG
Kin(Gold): KI
Kaku(Bishop): KA UM
Hisha(Rook): HI RY
Ou(King): OU
Note:
Top Right square coordinate is (1,1)
Bottom Left square coordinate is (9,9)
Source square for dropping move is 00
Promotion is specified by the name of the piece after promotion

Example:

+7776FU Black moves Pawn from (7,7) to (7,6)
-0034KA White drops Bishop to (3,4)
+2423TO Black moves Pawn from (2,4) to (2,3) and promotes

(b) Special command ( do not prefix + nor - )

Resign : %TORYO
Take Back: %MATTA
Interruption: %CHUDAN
Repetition: %SENNICHITE
Draw: %JISHOGI
Declaring a win
after the king has entered the opponent's camp: %KACHI
Declaring a draw
after the king has entered the opponent's camp: %HIKIWAKE

For (a) and (b), attach a line feed LF(0x0a) character at the end of the move and command string

A Take-Back command can be only be issued by the communication program being used by the operator of a shogi program without communication capability. If the operator makes a mistake entering a move in the communication program, the operator should wait before issuing the Take-Back command until the operator side gets his/her turn. If a shogi-program receives a Take-Back command, it must retract to the position of two moves earlier.

Draw, Declare-Win, and Declare-Draw are defined by the tournament rules.

(2) Communication Conditions

We use an RS232C communication line between the two computers.
Baud rate: 1200 BPS
Data length: 8 bit
Parity: No
Stop Bit: 1 bit
X-flow-control: ON

(3) Connector and Cable

Computer's Connector: D-Sub 9 pins male connector
Cable's Connector: D-sub 9 pins female connector
Cable: Reverse cable

For computers without a D-Sub 9 pins male connector, the operator can use the converting connector to comply with the standard.

A cable with converting connector can be used if necessary.

(4) At the start:

Confirm that the opponent is ready to receive a move. The program with black's turn will start.

(5) At the end:

(a) Resignation

The game will end by the sending of a resign command. When a program decides to resign, it will send the resign command(%TORYO).
When a program checkmates an opponent, the program should wait until it receives a resign command from the opponent. The game will continue until the receipt of a resign command.

(b) Repetition

A program can issue the repetition command(%SENNICHITE) on its turn when it has detected that the current position is a repeated position and the game will end. Although a program can detect a repeated position after making a move by itself, it should wait for the repetition command from the opponent (it should not interrupt the game by itself).
Upon receipt of a repetition command, the game will end.
In either case, the program is required to have the capability to restart the game from that position.

(c) Draw

When a program has determined that the position is drawn, it should send the draw(%JISHOGI) command and end the game. (A draw is determined by the tournament rules.)

(d) Interruption

During the receiving state, programs must be capable of being interrupted by a human operation. If such an operation is performed by a human, it should carry out the same process as if it had received an interruption command from its opponent.

(6) Restarting( desirable capabilities )

Ideally, a program will have the capability of restarting from an interrupted position.

If the number of moves played by the two playing programs is different, the operator of the program that has played more moves will retract to the opponent's position so that both programs will have the same position.
The time also will be retracted accordingly.

(a) For programs with communication capability

The program not having a turn will be put into the receiving state.
The program having a turn will be put into the thinking state.

(b) For programs without communication capability

The program not having a turn will be put into the waiting state for its opponent's move.
The program having a turn will be put into the thinking state.

(7) In case of trouble

In case of receiving illegal moves or an unknown string, the program should display the receiving string on the screen and perform the interrupt process.

(8) ETC

When two programs are playing directly using a communication protocol, neither program is allowed to issue or accept the Take-Back and Interrupt commands.