Flits Dxp Server

Discussion about development of draughts in the time of computer and Internet.
Ed Gilbert
Posts: 859
Joined: Sat Apr 28, 2007 14:53
Real name: Ed Gilbert
Location: Morristown, NJ USA
Contact:

Flits Dxp Server

Post by Ed Gilbert » Tue Apr 20, 2010 14:01

I now have a prototype dxp server running with flits and have started running an automated engine match between flits and kingsrow. The flits server is much different than the one for truus. There was no need to reverse engineer anything or find any internal data locations. Bert was aware of a Uw zet window in which text commands can by typed to do some common user interface functions, like setup for a new game, flits plays black, flits plays white, 2-player mode, etc. Using the Spy tool that is part of the MS toolset in Developer Studio, I was able to see the various windows and controls in the flits interface. The win32 api has the function FindWindowEx which can be used to obtain the handle of windows even if they are in another process. Using this function I can get the handle of the text control in the Uw zet window and send text commands to start games and make moves. Flits also has a Zetverloop window which displays a pdn list of all the moves in the current game. By obtaining the handle to this control I am able to read the moves and detect when flits has moved and know what its move is.

I started a match last night and it is still running this morning without any apparent problems after about 50 games! I am aware of a few of things which are not perfect. The command to make moves does not seem to have a way of dealing with ambiguous captures, so if kingsrow makes a move of this type then there is no way for the flits server to make this move on the flits board. I think this problem can be solved though, because the flits user interface does have a way to input ambiguous captures with the mouse, by clicking on the from and to squares and then on one of captured pieces. I can also send mouse Windows messages to the board window. But this will be a bit more work as I will have to query this window's dimensions, translate the board squares to x,y coordinates, etc. Another problem is that the Zetverloop window does not display ambiguous captures in an unambiguous format, so if flits makes one of these moves then the server will not know which move it made. Fortunately these ambiguous captures are rare in real games, so perhaps they can be ignored.

I was unaware of a flits text command to setup an arbitrary position, and this created a problem with the dxp GAMEREQ command with a start position. I usually run engine matches using 2-move ballots as the start positions so I needed a way to set this up. I solved this by setting flits to the normal game start position in 2-player mode, and then do a 2-ply tree walk from this root position until the GAMEREQ start position is found. This gives the sequence of moves to get from the root to the GAMEREQ start position, and these can be made in 2-player mode to prevent flits from interfering with response moves.

After the kingsrow matches I would like to run some matches between flits and truus. Right now this is not possible because both servers only have dxp Follower functionality, and one needs to act as Initiator to have a match. I think I can modify the truus server to be an Initiator. The Initiator needs to have knowledge of the search scores so it can adjudicate game results. The truus server can now see the search scores, the result of a recent modification, so a truus Initiator should be possible.

-- Ed

Rein Halbersma
Posts: 1722
Joined: Wed Apr 14, 2004 16:04
Contact:

Re: Flits Dxp Server

Post by Rein Halbersma » Tue Apr 20, 2010 15:20

Ed Gilbert wrote:I now have a prototype dxp server running with flits and have started running an automated engine match between flits and kingsrow. The flits server is much different than the one for truus. There was no need to reverse engineer anything or find any internal data locations. Bert was aware of a Uw zet window in which text commands can by typed to do some common user interface functions, like setup for a new game, flits plays black, flits plays white, 2-player mode, etc. Using the Spy tool that is part of the MS toolset in Developer Studio, I was able to see the various windows and controls in the flits interface. The win32 api has the function FindWindowEx which can be used to obtain the handle of windows even if they are in another process. Using this function I can get the handle of the text control in the Uw zet window and send text commands to start games and make moves. Flits also has a Zetverloop window which displays a pdn list of all the moves in the current game. By obtaining the handle to this control I am able to read the moves and detect when flits has moved and know what its move is.

I started a match last night and it is still running this morning without any apparent problems after about 50 games! I am aware of a few of things which are not perfect. The command to make moves does not seem to have a way of dealing with ambiguous captures, so if kingsrow makes a move of this type then there is no way for the flits server to make this move on the flits board. I think this problem can be solved though, because the flits user interface does have a way to input ambiguous captures with the mouse, by clicking on the from and to squares and then on one of captured pieces. I can also send mouse Windows messages to the board window. But this will be a bit more work as I will have to query this window's dimensions, translate the board squares to x,y coordinates, etc. Another problem is that the Zetverloop window does not display ambiguous captures in an unambiguous format, so if flits makes one of these moves then the server will not know which move it made. Fortunately these ambiguous captures are rare in real games, so perhaps they can be ignored.

I was unaware of a flits text command to setup an arbitrary position, and this created a problem with the dxp GAMEREQ command with a start position. I usually run engine matches using 2-move ballots as the start positions so I needed a way to set this up. I solved this by setting flits to the normal game start position in 2-player mode, and then do a 2-ply tree walk from this root position until the GAMEREQ start position is found. This gives the sequence of moves to get from the root to the GAMEREQ start position, and these can be made in 2-player mode to prevent flits from interfering with response moves.

After the kingsrow matches I would like to run some matches between flits and truus. Right now this is not possible because both servers only have dxp Follower functionality, and one needs to act as Initiator to have a match. I think I can modify the truus server to be an Initiator. The Initiator needs to have knowledge of the search scores so it can adjudicate game results. The truus server can now see the search scores, the result of a recent modification, so a truus Initiator should be possible.

-- Ed
Hi Ed,

This is really great work! A full 2-ballot tournament between Kingsrow, Damage, Flits, Truus, DragonDraughts and Dam 2.2 would be an interesting thing to see. I would suspect that the outcome of such a match would greatly upset the current rating list. :-)

It's a pity there is no universal GUI as the chess folks have (UCI and WinBoard). Are you aware of the CuteChess project where they have a command-line engine match? http://repo.or.cz/w/sloppygui.git/blob/ ... ematch.cpp If we ever get a sort of UDI protocol then it should be straightforward to adapt this code around it.

Rein

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

Re: Flits Dxp Server

Post by Ed Gilbert » Tue Apr 20, 2010 16:05

Rein Halbersma wrote:This is really great work! A full 2-ballot tournament between Kingsrow, Damage, Flits, Truus, DragonDraughts and Dam 2.2 would be an interesting thing to see. I would suspect that the outcome of such a match would greatly upset the current rating list. :-)

It's a pity there is no universal GUI as the chess folks have (UCI and WinBoard). Are you aware of the CuteChess project where they have a command-line engine match? http://repo.or.cz/w/sloppygui.git/blob/ ... ematch.cpp If we ever get a sort of UDI protocol then it should be straightforward to adapt this code around it.
I should have mentioned that Bert and I collaborated on architecting this flits server, and he deserves much of the credit for making it possible.

Yes I have read about CuteChess, and also the informal monthly blitz tournaments that the chess guys run. It would be great if we could do those things. A tournament manager like CuteChess could be built using the Dxp protocol. We need more engines that are Dxp aware. Right now it is only kingsrow, damage, flits, truus, tornado, and dam2.2, so not much of a quorum for a tournament.

-- Ed

User avatar
steenslag
Posts: 1184
Joined: Sun Sep 21, 2003 10:09
Contact:

Re: Flits Dxp Server

Post by steenslag » Thu Apr 22, 2010 00:26

Ed Gilbert wrote:I now have a prototype dxp server running with flits and have started running an automated engine match between flits and kingsrow. The flits server is much different than the one for truus. There was no need to reverse engineer anything or find any internal data locations. Bert was aware of a Uw zet window in which text commands can by typed to do some common user interface functions, like setup for a new game, flits plays black, flits plays white, 2-player mode, etc. Using the Spy tool that is part of the MS toolset in Developer Studio, I was able to see the various windows and controls in the flits interface. The win32 api has the function FindWindowEx which can be used to obtain the handle of windows even if they are in another process. Using this function I can get the handle of the text control in the Uw zet window and send text commands to start games and make moves. Flits also has a Zetverloop window which displays a pdn list of all the moves in the current game. By obtaining the handle to this control I am able to read the moves and detect when flits has moved and know what its move is.

I started a match last night and it is still running this morning without any apparent problems after about 50 games! I am aware of a few of things which are not perfect. The command to make moves does not seem to have a way of dealing with ambiguous captures, so if kingsrow makes a move of this type then there is no way for the flits server to make this move on the flits board. I think this problem can be solved though, because the flits user interface does have a way to input ambiguous captures with the mouse, by clicking on the from and to squares and then on one of captured pieces. I can also send mouse Windows messages to the board window. But this will be a bit more work as I will have to query this window's dimensions, translate the board squares to x,y coordinates, etc. Another problem is that the Zetverloop window does not display ambiguous captures in an unambiguous format, so if flits makes one of these moves then the server will not know which move it made. Fortunately these ambiguous captures are rare in real games, so perhaps they can be ignored.

I was unaware of a flits text command to setup an arbitrary position, and this created a problem with the dxp GAMEREQ command with a start position. I usually run engine matches using 2-move ballots as the start positions so I needed a way to set this up. I solved this by setting flits to the normal game start position in 2-player mode, and then do a 2-ply tree walk from this root position until the GAMEREQ start position is found. This gives the sequence of moves to get from the root to the GAMEREQ start position, and these can be made in 2-player mode to prevent flits from interfering with response moves.

After the kingsrow matches I would like to run some matches between flits and truus. Right now this is not possible because both servers only have dxp Follower functionality, and one needs to act as Initiator to have a match. I think I can modify the truus server to be an Initiator. The Initiator needs to have knowledge of the search scores so it can adjudicate game results. The truus server can now see the search scores, the result of a recent modification, so a truus Initiator should be possible.

-- Ed
You seem pretty capable of handling the win32api barehanded. For what it's worth, I found AutoIt much, much easier to deal with. It comes with a Spy-like tool and a dll/COM control. Once installed you can use these functions (I found the ones starting with "control..." or "win..." usefull.)

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

Re: Flits Dxp Server

Post by Ed Gilbert » Thu Apr 22, 2010 00:54

I have now finished two 158-game automated matches between kingsrow and flits using the new dxp server. The server worked flawlessly throughout both matches, which is really good news. There were no ambiguous captures encountered in 316 games, so I am satisfied that this will not be a problem. Bert has just sent me an email with some info about his experiments sending mouse messages to the board window in setup mode, so I will look into that.

Both matches were played on the Q6600 Intel quad-core machine. The first match was played with time lmits of 75 moves in 9 minutes for each side. The second match was a blitz match with 75 moves in 2 minutes per side. In the second match I also configured kingsrow to use only its 6-piece endgame db. This was a nice quick match as I started it before I left for work this morning and it was finished before I returned home in the afternoon.

Results:

Match 1: kingsrow/9pc vs. flits: 32 wins, 2 losses, 124 draws
Match 2: kingsrow/6pc vs. flits: 39 wins, 3 losses, 116 draws

I guess these results look a bit strange as you would expect kingsrow to do better with the larger dbs. It usually does do a little better on average, but there is so much randomness in only 158 games that it would take a lot more games to discern the difference with any certainty.

I have looked at the losses and I see a pattern between some of these losses and also one of the kingsrow losses in the match against damage a week ago, so I have some things to work on.

I was expecting this match to show that flits is a little stronger than truus, but it didn't turn out that way. I still think that is the case, and I'm going to try to enhance one of these servers to also act as a dxp client and Initiator so I can run some automated flits vs. truus matches.

-- Ed

Rein Halbersma
Posts: 1722
Joined: Wed Apr 14, 2004 16:04
Contact:

Re: Flits Dxp Server

Post by Rein Halbersma » Thu Apr 22, 2010 07:36

Ed Gilbert wrote:I have now finished two 158-game automated matches between kingsrow and flits using the new dxp server. The server worked flawlessly throughout both matches, which is really good news. There were no ambiguous captures encountered in 316 games, so I am satisfied that this will not be a problem. Bert has just sent me an email with some info about his experiments sending mouse messages to the board window in setup mode, so I will look into that.

Both matches were played on the Q6600 Intel quad-core machine. The first match was played with time lmits of 75 moves in 9 minutes for each side. The second match was a blitz match with 75 moves in 2 minutes per side. In the second match I also configured kingsrow to use only its 6-piece endgame db. This was a nice quick match as I started it before I left for work this morning and it was finished before I returned home in the afternoon.

Results:

Match 1: kingsrow/9pc vs. flits: 32 wins, 2 losses, 124 draws
Match 2: kingsrow/6pc vs. flits: 39 wins, 3 losses, 116 draws

I guess these results look a bit strange as you would expect kingsrow to do better with the larger dbs. It usually does do a little better on average, but there is so much randomness in only 158 games that it would take a lot more games to discern the difference with any certainty.

I have looked at the losses and I see a pattern between some of these losses and also one of the kingsrow losses in the match against damage a week ago, so I have some things to work on.

I was expecting this match to show that flits is a little stronger than truus, but it didn't turn out that way. I still think that is the case, and I'm going to try to enhance one of these servers to also act as a dxp client and Initiator so I can run some automated flits vs. truus matches.

-- Ed
Hi Ed,

Can't you run 2 matches simultaneously: Truus-Kingsrow and Kingsrow-Flits and let Kingsrow relay the moves that Truus and Flits play to the other match? So e.g., if Truus plays (in the ballot 1.31-26 16-21) 2. 37-31, then you also play (in the same ballot) against Flits 2.37-31. etc. etc. Then Truus will be playing against Flits, effectively :-)

Rein

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

Re: Flits Dxp Server

Post by Ed Gilbert » Thu Apr 22, 2010 13:43

steenslag wrote:For what it's worth, I found AutoIt much, much easier to deal with. It comes with a Spy-like tool and a dll/COM control. Once installed you can use these functions (I found the ones starting with "control..." or "win..." usefull.)
Thanks, that does look like it could be used to do some of the controls functions that are in the flits server. I may try it to send some flits menu selections.

-- Ed

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

Re: Flits Dxp Server

Post by Ed Gilbert » Thu Apr 22, 2010 13:54

Rein Halbersma wrote:Can't you run 2 matches simultaneously: Truus-Kingsrow and Kingsrow-Flits and let Kingsrow relay the moves that Truus and Flits play to the other match? So e.g., if Truus plays (in the ballot 1.31-26 16-21) 2. 37-31, then you also play (in the same ballot) against Flits 2.37-31. etc. etc. Then Truus will be playing against Flits, effectively :-)
Yes, that would be one way to do it. I've been thinking some more about your idea of a tournament manager. Maybe we do have enough engines to make a tournament interesting. The manager could act as a dxp Initiator, pair up opponents, relay the moves, and keep track of all the results. I could host the server on one of my machines, and run instances of kingsrow, flits, truus, and dam2.2. If we could get the participation of damage and perhaps one or 2 other engines on a Saturday afternoon of blitz games we could have some fun.

-- Ed

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

Randomness of engine matches

Post by Ed Gilbert » Sat Apr 24, 2010 14:25

I made a couple of eval changes to kingsrow, and to test them I started up 6 simultaneous engine matches on the 8-core dual xeon machine. Each match plays the new test version of kingsrow against a baseline version that does not have the eval changes. The 2-move ballot matches are about 2/3 completed, and the results are all over the place.

match 1: +0, -4, =98
match 2: +5, -4, =95
match 3: +3, -4, =95
match 4: +2, -4, =98
match 5: +7, -3, =95
match 6: +6, -6, =93

These are fairly fast games of 75 moves in 5 minutes. Each engine is using a 7pc db, single search thread with pondering off, and 1000mb of egdb cache.

It is clear that there is too much randomness to draw any conclusions from the results of just one of these matches, and even when all 6 are summed the differences between these two program versions is too small to measure with 948 games. Maybe with about 10,000 games the results would start to become useful. I can speed the games up to 75 moves in 1 minute, and change the matches to use 3-move ballot start positions, which would make each match consist of about 700 games, and then increase the number of matches from 6 to 8, using all 8 cores of the machine. This might give some useful results.

-- Ed

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

Re: Flits Dxp Server

Post by Ed Gilbert » Tue Apr 27, 2010 00:06

I modified the flits dxp server so that it can be a dxp Initiator and a socket client as well as a Follower and a server, and I modified the truus dxp server to be able to adjudicate game results, which means that it sends DXP_GAMEEND messages when it thinks it can declare the outcome of a game as W, L, or D. I can now play an automated match between flits and truus. I started one earlier today, and it ran for 68 games before hanging in the truus server code. The truus server is not perfect and gets stuck about once every hundred games or so. There is some critical region in detecting a board change which I have not been able to fix. Maybe I could fix the problem if I spent enough time on it, but the truus user interface also has another problem which I cannot fix -- it has a GDI object leak. Every time it draws the board, after every move, it consumes a GDI object and does not return it to Windows. Windows only has a few thousand of these objects, so after about 80 games truus has used up all the GDI objects in Windows the desktop of my computer gets corrupted and is basically unviewable. The programs continue to run but you cannot see what is going on! Usually when this happens I kill truus and that frees all the GDI objects so that my desktop is back to normal. The net result is that the truus dxp server never runs for more than about 80 or 90 consecutive games before I have to restart it, so there is not much incentive for me to fix the other problem which also occurs very infrequently.

Anyway the first 68 games resulted in (from the perspective of Flits) 5 wins, 2 losses, 60 draws, and 1 unknown. The games are played at 5 minutes per side for 75 moves. I have resumed the match and will report the results after a few hundred games.

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

Re: Flits Dxp Server

Post by Ed Gilbert » Fri Apr 30, 2010 00:44

Anyway the first 68 games resulted in (from the perspective of Flits) 5 wins, 2 losses, 60 draws, and 1 unknown. The games are played at 5 minutes per side for 75 moves. I have resumed the match and will report the results after a few hundred games.
I had to scrap the first match because I found a few problems. I accidently deleted the games when I resumed it in the middle, and I also discovered that truus was not 100% reliable in judging the wins, losses, draws. I ran 2 new matches, this time saving all the games, and then loaded them into kingsrow to determine the WLD results. Results:

Match 1: Flits vs Truus: 23 wins, 9 losses, 126 draws, 0 unknowns
Match 2: Flits vs Truus: 21 wins, 17 losses, 120 draws, 0 unknowns

These might seem to show a slight edge to flits, but I would have to do this a few more times before I could declare a clear winner. There is probably not a big difference between them.

These matches showed something about flits that I had seen before -- once in a while it makes terrible moves in very simple endings. Here is one example:

[Event "Game 37, opening 33-29 17-22"]
[Date "2010.4.29"]
[White "Flits"]
[Black "Truus"]
[Result "0-1"]
1. 33-29 17-22 2. 39-33 11-17 3. 44-39 6-11 4. 34-30 1-6 5. 30-24 19x30 6. 35x24 17-21 7. 31-27 22x31 8. 37x17 11x22 9. 50-44 16-21 10. 32-28 21-26 11. 28x17 12x21 12. 36-31 26x37 13. 41x32 7-11 14. 46-41 11-16 15. 41-37 21-26 16. 32-28 6-11 17. 37-31 26x37 18. 42x31 11-17 19. 31-27 18-23 20. 28x19 14x34 21. 40x29 10-14 22. 45-40 13-19 23. 24x13 9x18 24. 47-41 4-9 25. 39-34 14-19 26. 44-39 19-23 27. 40-35 17-22 28. 49-44 22x31 29. 33-28 23x32 30. 38x36 5-10 31. 43-38 16-21 32. 41-37 9-13 33. 37-32 21-26 34. 48-42 13-19 35. 44-40 20-24 36. 29x20 15x24 37. 39-33 8-12 38. 33-29 24x33 39. 38x29 2-7 40. 42-38 10-14 41. 38-33 14-20 42. 35-30 3-9 43. 40-35 20-25 44. 29-24 19-23 45. 33-28 12-17 46. 28x19 17-21 47. 32-28 18-22 48. 28x17 21x12 49. 19-13 9x18 50. 24-19 26-31 51. 36x27 18-22 52. 27x18 12x14 53. 34-29 {???} 25x23 54. 35-30 0-1

This game was ending as an easy draw, but at move 53 flits inexplicably turned it into a loss with 34-29. In the first match flits lost 2 games this way, and in the second match it lost 3. It always happens when there are very few pieces left on the board and when the result is very clear. It looks like a form of search instability. I have seen this behavior playing games with it manually, so I'm confident it has nothing to do with the dxp server operation.

-- Ed

Piet Bouma
Posts: 3574
Joined: Sun Nov 02, 2003 13:05
Location: Harlingen

Re: Flits Dxp Server

Post by Piet Bouma » Fri Apr 30, 2010 14:19

Ed Gilbert wrote:
Rein Halbersma wrote:Can't you run 2 matches simultaneously: Truus-Kingsrow and Kingsrow-Flits and let Kingsrow relay the moves that Truus and Flits play to the other match? So e.g., if Truus plays (in the ballot 1.31-26 16-21) 2. 37-31, then you also play (in the same ballot) against Flits 2.37-31. etc. etc. Then Truus will be playing against Flits, effectively :-)
Yes, that would be one way to do it. I've been thinking some more about your idea of a tournament manager. Maybe we do have enough engines to make a tournament interesting. The manager could act as a dxp Initiator, pair up opponents, relay the moves, and keep track of all the results. I could host the server on one of my machines, and run instances of kingsrow, flits, truus, and dam2.2. If we could get the participation of damage and perhaps one or 2 other engines on a Saturday afternoon of blitz games we could have some fun.

-- Ed
Hello Ed,

When the idea of a tournament between the machines is possible, should it be possible to serve on Internet a full .pdn (or more .pdn's), so that there can be a live-tournament on Internet with applets: Oerterp-applet or Dambo-lite (I think Wieger must make then some adjustments to read the .pdn into the live-version of Dambo-lite).
Should be nice watching the machines play live on Internet!
https:toernooibase.kndb.nl More than 415.000 games on applet, more than 1.300.000 results, more than 21.000 games broadcasted (semi-)live, more than 12.900 inserted tournaments!

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

Re: Flits Dxp Server

Post by Ed Gilbert » Tue Jun 08, 2010 02:19

I have put the flits server and truus server on my web site so they can be downloaded.

http://mysite.verizon.net/eygilbert/fli ... server.zip
http://mysite.verizon.net/eygilbert/tru ... server.zip

Read the .txt file in each zip archive for instructions.

-- Ed

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

Re: Flits Dxp Server

Post by Ed Gilbert » Tue Jun 08, 2010 10:24


Rein Halbersma
Posts: 1722
Joined: Wed Apr 14, 2004 16:04
Contact:

Re: Flits Dxp Server

Post by Rein Halbersma » Tue Jun 08, 2010 21:22

Ed Gilbert wrote:Sorry, I had to correct a typo in one of the links.

http://mysite.verizon.net/eygilbert/Fli ... server.zip
http://mysite.verizon.net/eygilbert/tru ... server.zip

-- Ed
Hi Ed (and Bert),

Thanks very much for making this great piece of work available! It's one hell of a reverse-engineering job to pull off.

Rein

Post Reply