by matematiko » 04 Dec 2010, 02:52
In my opinion a good starting point will be the source code of YtoICS, available at sourceforge.net, it is written in perl. The purpose of this script was to serve as a middle man between Yahoo and WinBoard (or xboard), making WinBoard beleive it was connecting to and ICS server, so you can call it adapter or emulator. same difference.
This script does not work any more because its author stopped development and never came up with a solution for Yahoo's CAPTCHA scheme implemented some years ago, nevertheless, it is only 50 Kb of code and is written in a very elegant way, keeps track of the players and their ratings as well the table(s) each player is at, if any. It also keeps tracks of each table, it's parameters (rated or not, timed or not, increment per move if applicable, etc.), and , its observers and its players. Some modifications here and there and I am sure this script can be used as a backbone or just as an example to create the client you want.
For those c oriented, the same author released "yics" which is YtoICS ported to c and is also available at sourceforge.net.
I do not know how well documented the protocol is, but packet sniffing sessions with any of the free network monitors(or sniffers if you wish) will be enough to discover non-documented opcodes (if any).
The good news is that it seems the server/client communications are not encrypted, so, whoever decides to create a client for this server will be spared of the burden of trying to figure it out.
Additional observations:
-YtoICS uses by default Style 12, a new style might be needed for Xianggi, I do not know
-The subroutine that "looks for moves" might need to be modify for Xianggi
-YtoICS comes with three(I believe) modules that serve the purpose of checking the legality of the move, checking if the game is over by checkmate, and all the types of draws, these modules might need modification as well. I think also the purpose of one of these modules is to create an algebraic notation of the board position (not sure).
For years I played with YtoICS code, then a year ago or so we decided to create a whole new client for another server (POGO), opcodes were different, encryption was different and many other things were different. We used YtoICS as starting point and evolved slowly until what it is now: A stable script. We had fun doing it and I am sure whoever decides to create a client for Xianggi will have lots of fun too.
Best regards,
One that does not live to serve, does not deserve to live.