Participation of draught engines in Kurnik

Discussion about development of draughts in the time of computer and Internet.
Post Reply
User avatar
FeikeBoomstra
Posts: 306
Joined: Mon Dec 19, 2005 16:48
Location: Emmen

Participation of draught engines in Kurnik

Post by FeikeBoomstra » Fri Sep 07, 2007 18:27

I have written an email to Marek Futrega. He is the owner of Kurnik. This is a gaming site, where you can play a lot of online games, one of them is international 10x10 draughts. I have asked him whether we would be allowed to compete with a draught engine. As such he agrees.
Unfortunately he is not able (I don't know why) to provide the message protocol, so that is something we have to reverse-engineer.

Is somebody interested in this?

Kind regards,

Feike Boomstra

Ed Gilbert
Posts: 859
Joined: Sat Apr 28, 2007 14:53
Real name: Ed Gilbert
Location: Morristown, NJ USA
Contact:

Post by Ed Gilbert » Sat Sep 08, 2007 17:32

Hi Feike,

I am assuming that the purpose of this is to play engine vs engine games? If this were possible at Kurnik, you would need to schedule such a match with your opponent, because the probability of finding another draughts engine there at random would be quite low. There is already an established protocol for engine vs engine draughts matches over the internet -- DamExchange. Is there a reason that Kurnik would be a better alternative? I have added DamExchange to kingsrow, and I am always looking for opponents for some informal engine matches. Watching engine vs engine matches and seeing how your program gets into difficulty is a good way to see how to improve it.

-- Ed

User avatar
FeikeBoomstra
Posts: 306
Joined: Mon Dec 19, 2005 16:48
Location: Emmen

Post by FeikeBoomstra » Sun Sep 09, 2007 14:25

Hi Ed,

You are right, Damexchange can do the one to one playing very well. Unfortunately the server part is non existent.

I have implemented damexchange too. At the moment my program is not working and I am busy to get my development environment working (again). Linux (Fedora 6) 64 bits, eclipse, svn and the intel compiler/debugger/analyzer. Once everything is working again I am quite willing to have a few matches with you over the internet.

My ideas toward Kurnik are:

a) you could use Kurnik to administrate tournaments
b) you could also play against human players, and in this way collect a lot of data to improve your engine.

kind regards,
Feike Boomstra

Ed Gilbert
Posts: 859
Joined: Sat Apr 28, 2007 14:53
Real name: Ed Gilbert
Location: Morristown, NJ USA
Contact:

Post by Ed Gilbert » Sun Sep 09, 2007 19:39

I guess a server would make things a bit easier. It does not sound like Kurnik management is very keen on the idea though if they wont give out the protocol. I have never used DamExchange to go outside of my private home LAN, but I think it should work ok if I set the router to allow that port to be open. Let me know when you have your program running and we can give it a try.

I am also using svn for version management. The rest is Microsoft tools -- Visual Studio, C++, and XP-64.

-- Ed

User avatar
wellnesswrotter
Posts: 323
Joined: Mon May 21, 2007 15:10
Location: www.snukenkuzco.nl
Contact:

help

Post by wellnesswrotter » Fri Jan 16, 2009 16:24

I don't get DamExchange because i am no C++ programmer.
Who can get me on the way?

Ed Gilbert
Posts: 859
Joined: Sat Apr 28, 2007 14:53
Real name: Ed Gilbert
Location: Morristown, NJ USA
Contact:

Post by Ed Gilbert » Fri Jan 16, 2009 19:13

Johan, have you read the description here? http://www.mesander.nl/

User avatar
FeikeBoomstra
Posts: 306
Joined: Mon Dec 19, 2005 16:48
Location: Emmen

Post by FeikeBoomstra » Fri Jan 16, 2009 21:02

I suppose even in C# you have sockets

User avatar
wellnesswrotter
Posts: 323
Joined: Mon May 21, 2007 15:10
Location: www.snukenkuzco.nl
Contact:

andThen

Post by wellnesswrotter » Sat Jan 17, 2009 09:09

Yes i have read it.
And yes, i got the functions to be recognized in Visual Studio.

and then? [img]images/smilies/icon_redface.gif[/img]

Ed Gilbert
Posts: 859
Joined: Sat Apr 28, 2007 14:53
Real name: Ed Gilbert
Location: Morristown, NJ USA
Contact:

Post by Ed Gilbert » Sat Jan 17, 2009 15:53

I guess you are asking how to use the dll functions? Because the layer 2 protocol is quite simple and adequately described on Frank's web site. You have 2 programs, a client (initiator) and a server (acceptor). Before starting a DamExchange game the server must be ready to accept client messages. The client sends GAMEREQ, and the server acks with GAMEACC. A series of MOVE messages are exchanged to play the game, until either side wants to end it and sends GAMEEND, which the other side acks with a GAMEEND response.

To do this with Frank's dll, you need to create some commands in your user interface to start the match and set the game parameters. In kingsrow I have 3 menu items in the DamExchange Game menu: "Make connection...", "Wait for connection", and "Terminate connection". To start a match between two instances of kingsrow, I first give the "Wait for connection" command in the server program. This calls the dll function dxp_socket_connect(). Dxp_socket_connect times out and returns in about 1 second if no connection requests are received, so you need to wrap this in an infinite loop and keep calling it until you get a 0 return value. Therefore you need to do this on its own separate thread so that your user interface is responsive while it is waiting for connection requests.

After you get the 0 return value indicating a connection was accepted, all subsequent messages in the server will be received by the normal window message handler. The token for these messages is the same WM_USER_x token that you sent to dxp_socket_connect() as the fourth argument, and the WPARAM is one of the particular DamExchange dll tokens like DXP_GAMEREQ, DXP_MOVE, etc. Each time your window handler gets one of these WM_USER_x messages you then call dxp_receive_message() to get the content of the message.

On the client side things are very similar. You start a match by clicking the "Make connection..." command. This causes the dxp_socket_connect() function to be called. Unlike the server side you only need to call it once. For this call you give the hostname or IP address of the server in the second argument instead of the NULL you give on the server. If you're running a match between two programs on the same host, you can use the local loopback IP 127.0.0.1.

A good way to debug your DamExchange code is to get Harm Jettten's Dam2.2 and set it as the opponent to your program. AFAIK this is the only public program that implements the full protocol.

-- Ed

bcheckers
Posts: 2
Joined: Wed Nov 25, 2009 20:55

Re: Participation of draught engines in Kurnik

Post by bcheckers » Wed Nov 25, 2009 21:03

hello,

i want to communicate in console mode with a GUI that supports DamExchange protocol on my computer.

so i need to write a code (c++) that could send/get moves to/from a Gui that supports DamExchange protocol.

i didnt found sourcecode of checkers GUI supporting this protocol...

as you describe it, there are several steps to do that, first step is to "open connection" with dxp_socket_connect() ...

as i am a beginner in programmation, i would be very grateful if you could post your damexchange code or any code that could send/get moves to a GUI that supports damexchange protocol.

any help very appreciated !!!

Post Reply