Page 1 of 2

Xiangqi client

PostPosted: 03 Dec 2010, 15:59
by Mwin
Would it be possible to develop the Xiangqi variant (Winboard 4.4.4) to be able to run as a client on playxiangqi.com and chesscape.com? Existing client cannot save games, which is a big deficit. If one can analyse the games afterwards then one develops faster.

Mats Winther

Re: Xiangqi client

PostPosted: 03 Dec 2010, 20:08
by H.G.Muller
Everything is possible, of course.

The question is what would be the best way to do it. Currently WinBoard understands only ICS protocol (as used by FICS) for communicating with an ICS and WinBoard protocol for communicating with an engine. Implementing a new protocol could be done internally, or through an adapter. My preference would be to use an adapter.

I am not sure what the best channel would be to connect such an adapter to WinBoard. One could write an adapter as a pseudo-engine (there is an adapter to make BCMShogi connect to the Floodgate Shogi server that way, and in the past I wrote a 'Gothoglot' adapter to connect WinBoard to a Gothic-Chess server). Or one could write a telnet-like adapter to which WinBoard connects through the ICS channel.

The disadvantage of the pseudo-engine approach is that it does not provide commands for inter-user communication or opponent selection. The ICS channel does contain such commands, but the protocol is very cumbersome. Apseudo-engine couldofcourse be made topop up a consolewindow by itself, to handle the user communication part, but that would make it a GUI application in itself, and thus far more complex.

Someone here has experience in building an adapter for the ICS channel, for connecting to the yahoo Chess server. I don't know if this is open source, however. If it was, it might be possible to adapt the protocol itusesat the other end to playxiangqi protocol. Provided this protocol is described somewhere.

Re: Xiangqi client

PostPosted: 03 Dec 2010, 20:12
by Mwin
The HOXChess client is open source, developed in C++. Perhaps its code can be utilized? (By the way, it now uses your Xiangqi engine as default for computer play.)
/Mats

Re: Xiangqi client

PostPosted: 03 Dec 2010, 20:32
by H.G.Muller
Yes, I know. (Also about the engine. :mrgreen: ) GUIs tend to be very complex programs, however, and trying to figure out the protocol from the code of one is probably not the most efficient way.

Re: Xiangqi client

PostPosted: 03 Dec 2010, 21:26
by Josh Pettus
I fear Yay and YaYp aren't opensource, and I agree with him that this is rightfully so. Both Yahoo and Pogo were not initially meant to be used with an outside GUI and having the code open would be a bit of a security breech. But Matematiko is the man to talk to about that.

Re: Xiangqi client

PostPosted: 03 Dec 2010, 22:20
by H.G.Muller
The playxiangqi.com protocol, at least, is well documented:

http://code.google.com/p/hoxchess/wiki/ ... layXiangqi

Re: Xiangqi client

PostPosted: 04 Dec 2010, 02:52
by matematiko
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,

Re: Xiangqi client

PostPosted: 04 Dec 2010, 09:03
by Mwin
Every Xiangqi game played on the servers is wasted because the games aren't stored on the servers either.

Another project would be to develop a tree database. Such databases, for Fide-chess, were present already in the DOS era. There are also freeware tree databases. Opening knowledge is even more important in Xiangqi, so it's strange that nobody has created a Xiangqi counterpart to Chess Assistant or TascBase. How can the professionals manage without good softwares? I bought the most sophisticated one, namely Stoneman (together with Giant), but Stoneman crashes when I import a game into it. Xiangqi is the most popular game in the world. Despite this, there seems to be no pressure for good softwares, that's curious.

The question remains whether there isn't good money to earn from developing a good tree database. It could be that the Chinese haven't understood the enormous applicability for such a software. Or maybe they simply don't like it, as they think it removes the magic in Xiangqi. Westerners, I think, have a more scientific attitude, we are prone to objective research, also among the amateurs. But the Chinese think differently.

Mats

Re: Xiangqi client

PostPosted: 04 Dec 2010, 09:58
by Mathieu
Mwin wrote:Xiangqi is the most popular game in the world. Despite this, there seems to be no pressure for good softwares, that's curious.

Maybe because it's a false assertion: many players know the game only because chinese people is 1/5 of the world population. But does this mean the game is well spreaded? No : outside eastern asia, the game is not that well known.
And knowing a game is different than liking a game... So "the most popular game" is VERY subjective.

One has to be careful with the numbers, as we can give them any meaning we want to.

Re: Xiangqi client

PostPosted: 04 Dec 2010, 10:20
by Mwin
It's the most popular game by sheer numbers, it's a fact. It is played foremostly in China, Japan, Vietnam, Cambodia, and Indonesia. However, it is today played by an increasing number of players in Europe, Australia, and America, too, as can be seen from World Xiangqi federation site: http://99.237.250.152/wxf/

Of course, all those peasant players in China aren't prone to buy a Xiangqi database, if that's what you mean, but I'm speaking about the future development of the game. In the future, people might actually want to learn the game seriously.

Mats

Re: Xiangqi client

PostPosted: 04 Dec 2010, 11:20
by Mathieu
No, I meant that the fact that many players plays the game is due to the fact that it's a chinese game, the world's biggest country in terms of inhabitants. Numbers are then biased. You can always find numbers that show what you want to show.
I wrote my last message because you were curious about a so poor coverage for a game believed to be the most popular. And in fact if so many people believe it's the most popular game is because they read it somewhere on the web with the "proof" that so many people know the game. But numbers can mislead, and it depends on what you are focused on (number of players, number of softwares, number of sold boards or so many other things). And playing a game doesn't mean it's popular. I learnt to play draught and chekers, but I don't like those games. Another true fact is that it is not wide spread, so is it really the most popular one? Western chess is also well known in China, but hugely wider spread all over the world. Does it means this is the most popular one, Even that I won't tell, it's too subjective to answer such a question.
Last thing : I know wxf, and many others as I like to know games played all over the world, so My opinion is not due to a lack of knowledge. And the link you give is not relevant to me a game federation will always say his game is the best one, they just advertise their own game ;)
I won't argue anymore since it is not the topic's subject and again, it's too subjective.

Re: Xiangqi client

PostPosted: 04 Dec 2010, 11:57
by Mwin
Well, then, in a sense Xiangqi is the most popular game in the world. I think it says something about the game. Interestingly, there seems to be quite a number of female professionals. Xiangqi is slightly vulgar, compared with international chess. It's all about tactics, no positional play, not much refinement. But it's quite fun. The Chinese, too, think it's somewhat populistic, compared with the refined game of Go.

Re: Xiangqi client

PostPosted: 04 Dec 2010, 13:00
by H.G.Muller
Have you looked at Pham Hong Nguyen's website ( http://www.xqfan.com )?

Re: Xiangqi client

PostPosted: 04 Dec 2010, 13:28
by Mwin
Thanx. I'd wish I had known about this before. (But the XB database link is broken).

Mats

Re: Xiangqi client

PostPosted: 05 Dec 2010, 11:35
by Mwin
I just realized that Chesscape, where the weakest players are, can send WXF games one by one, to one's email account. The freeware Qianhong can read WXF.
/Mats

Re: Xiangqi client

PostPosted: 05 Dec 2010, 13:38
by Mathieu
Do you know a server where you don't choose your color?
I used to play on clubxiangqi.com and playOK.com but it works like chesscape (I did not knew before your last message). All work about the same :( => choose or create a table, then choose the color and wait an opponent.
I'm looking for something more close to FICS in chess : set time control and just let the server choose the color.
So any adress or tip for the sites I gave would be very welcome.

Re: Xiangqi client

PostPosted: 05 Dec 2010, 14:36
by Mwin
I have only played on playxiangqi and chesscape. But I prefer Chesscape because one can save the games. By the way, I found the freeware Saola on the web:
http://sharingcentre.net/forum/6786-sao ... mediafire/

It is superior because you can analyse games, and there is a game database viewer. I spent much money the other day on two XQ softwares that play much stronger, but aren't nearly as useful.
/Mats

Re: Xiangqi client

PostPosted: 06 Dec 2010, 09:08
by H.G.Muller
The strongest Xiangqi engines I know are Cyclone and GagaChess. Both are commercial engines using UCI protocol. So they can be played under WinBoard. Actually the author of Cyclone was so friendly to send me an executable of Cyclone2009 for testing. Analysis (and all other WinBoard functions) work quite well with it.

Saola was a bit disappointing to me, strengthwise, in comp-comp games. It could be that it is optimized for play against humans and analysis, where knowledge is important. But in comp-comp games knowledge often backfires, and engines with a simplistic evalution often do better. My engine HaQiKi D (that definitely falls in the simplistic-eval category) can keep up with Saola quite well, and in bullet games even seems to have an edge on it.

Re: Xiangqi client

PostPosted: 06 Dec 2010, 19:27
by Mwin
But chess and Xiangqi are so different. I've been in the game long (I wrote sporadically for the SSDF magazine in the eighties) and chess programs have suffered greatly from the insistence on part of programmers to make them into little more than "bean counters". Fritz is such an example. I don't know how this engine is today, but it always played sterile chess without strategical insight. Most engines always played the same unintelligent move because the programmers have always thought that this "bean counting" move is objectively the best. This has driven chess lovers into despair. Engines have always played positionally badly, and one often gets the strategical initiative. As they, historically, haven't been able to play proper chess, many chess lovers have lost interest in them. Things are different today, of course, when the best programs can play good chess, I suppose.

It is for this reason that chess programs must be so immensely strong in order to play good chess. But I believe Xiangqi is different, simply because there is no such thing as strategy in Xiangqi. It is always about tactics. For this reason, I believe, one cannot really become bored with the unintelligent play of an engine. One cannot identify it as stupid and sterile play of a silicon brain, but it appears human because the game of Xiangqi is such. It is always about tactical finesses, and attack upon attack. Therefore I think that such engines as Saola are fully acceptable. An engine needn't be a piece of extremely advanced programming in order to make impression of human play. However, I'll only be able to judge whether this theory is correct when I have developed my skills.

/Mats

Re: Xiangqi client

PostPosted: 06 Dec 2010, 20:03
by H.G.Muller
Well, you can critisize Chess engines for playing dull, unattractive Chess, but the fact is that they now beat opponents with a different style, human and silicon alike. Attractive Chess seems to be losing Chess. I guess you cannot really blame the engines for that, it is a property of the game. Perhaps Xiangqi is fundamentally a more attractive game than Chess. (This is also partly a matter of taste, of course; some people might enjoy covert strategic manoeuvring to make a Pawn good, and eventually a decisive passer in the late end-game.)

Strategy is usually the weak point of my engines, as I am too lazy to write an elaborate evaluation, or the engine is for a game that Ido notplay myself, so I simply have no idea what to strive for strategically. But on the scale of things my Xiangqi engine HaQiKi D is a lot stronger than my Chess engine Joker. Because the lack of strategic knowledge apparently hurts Joker much more than HaQiKi D.

But if you are looking for strong Xiangqi engines: Kou 1.3 and BugCChess currently seem to be the strongest freeware engines. If you cannot find downloads for them on the web, (the Chinese forums stillseem tobe down), I could e-mail them to you.