DamExchange matches

Discussion about development of draughts in the time of computer and Internet.
Post Reply
Krzysztof Grzelak
Posts: 1028
Joined: Thu Jun 20, 2013 17:16
Real name: Krzysztof Grzelak

DamExchange matches

Post by Krzysztof Grzelak » Thu Dec 10, 2020 20:47

DamExchange is a protocol designed by Frank Mesander that allows two draughts programs to communicate and play games over a TCP/IP connection. A full description of DamExchange can be found at Frank's web site

The first step in running a DamExchange match is that the two programs need to establish a connection. One of the programs must listen for and accept connection requests, and the other program must make a connection request. After a connection is established, one of the programs takes on the role of a DXP Initiator by sending a request to start the first game to the other program. Included in the game request are details about the start position, which sides play black and white, and the time controls for this game and all subsequent games. The other program, which is called the Follower, can accept this request, and then the match is started and moves are exchanged. As the game progresses, either side can choose to end it. Included in the message to end the game is the reason for ending it. Four possible reasons are defined by the protocol: I win, I lose, I declare a draw, or no reason. After each game, only the Initiator can request to start another game. In this manner a match continues until either the Initiator stops sending new game requests, or the Follower refuses to accept a request.

To command Kingsrow to listen for requests from another program, use the menu Game, Wait for DXP connection. If you later want it to stop listening for requests you can give the menu command Game, Terminate connection.

To make a connection request to another program, use the menu Game, Make DXP connection... A hostname dialog is provided for you to enter either the IP address or the hostname of the computer on which the other program is running. If the other program is running on the same computer as Kingsrow, enter the local loopback address 127.0.0.1.

After a connection is established, you can start a match with Kingsrow as the Initiator by giving the command Game, Start match.... This brings up a dialog in which you can enter the maximum number of moves for each game and the maximum time that each side can use. If Kingsrow sees a dxpstats.txt file in the Kingsrow data directory with partial match results present, it will provide a Resume a previous match checkbox. If you check this box, the previous match will be resumed at the game where it was stopped.

When Kingsrow is the Initiator it plays a match of consisting of a large number of games using either 2-move or 3-move start positions. These are the positions reached after all possible sequences of the first two or three moves from the normal game start, except that the sequences that immediately lose a man are omitted. Each program gets to play one game with the black pieces and then another with the white pieces for each of these start positions. The purpose of the large variety of start positions is to avoid duplicate games. There are 79 2-move start positions (158 games) and 494 3-move positions (988 games).

Kingsrow maintains win/loss/draw/unknown statistics during the match and displays them in the program title bar. As each game is finished, it writes the statistics to the file dxpstats.txt, and it writes the game moves to the file dxpgames.pdn. These files are written in the Kingsrow data directory.

Kingsrow will declare a game won if its search returns a database win value, or a loss if its search returns a database loss value. It will declare a game drawn after it has seen 6 successive search scores of either database draw (+/-1, 3, or 5), or draw by repetition (+/-7), and if there are no more than 16 pieces remaining on the board. If a conclusive result is not reached after the maximum number of moves that were established for the games then the result is declared as unknown and the next game is started.

Other draughts programs
As of this writing I am aware of 3 publicly available programs that are capable of running DamExchange engine matches. The one that is most accessible is Dam2.2 by Harm Jetten which is a free download. There is also Truus and Flits, which are available for purchase from the KNDB, and for which I have written console server programs which allow these programs to participate in a DamExchange match. There should be links for downloading these at the Kingsrow International web site.

Step by step instructions for running an automated match between Kingsrow and Dam2.2
Before starting this match you should consider how to prevent the two programs from interfering with each other if they are both running on the same computer. The interference can come from competing for CPU resources and for RAM. If they're running on different computers then of course this is not a concern. To prevent CPU interference you only need to turn off Pondering in Kingsrow. Dam2.2 automatically turns off its pondering feature during DamExchange matches. To avoid RAM contentions you may need to reduce the size of the endgame database cache in Kingsrow so that there will be memory for Dam2.2 to use for its caching. If you have the 6-piece db for Dam then you should try to make a few hundred megabytes of RAM available for its use.

Run Dam and set it to listen for connection requests using the menu Game, DamExchange, Wait for connection.
Run Kingsrow and set it to connect to Dam using the menu Game, Make DXP connection...
Enter the IP address or hostname of the computer which is running Dam. If both programs are on the same computer then enter 127.0.0.1
Set Kingrow to use its opening book by using the menu Options, Opening book, Best moves.
You may want to open DamExchange windows in both programs so you can see the connection status and the communications between the programs. In both programs this is the same menu -- Window, DamExchange.
In Kingsrow give the command Game, Start Match... Enter 75 for Number of moves, and 5 for Time for moves. Do not check Resume a previous match.
Click the Accept button in the window that pops up in Dam.
After Kingsrow makes its first move, Dam will not start until you click on the Dam program window to make it the active window, and then press the Tab key.

Post Reply