A good time to broadcast a Xiangqi tourney?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
hgm
Posts: 27814
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

A good time to broadcast a Xiangqi tourney?

Post by hgm »

I have started working on my Xiangqi engine HaQiKi D again, and am making good progress. I was wondering if it would be a good idea to conduct a tourney of free Xiangqi engines that are capable of automated play (i.e. native WinBoard or UCCI), with live broadcasting over the internet. In the past, there were such events from the elephantbase.net website, but it seems its owner (Morning Yellow) stopped doing that. (This website is a bit hard to understand anyway, as it is all in Chinese...)

I already have quite a lot of engines installed that could play (I use them as opponents for HaQiKi D in my gauntlets); last year, in the preparation for Pamplona, I did this bullet tourney, in which an nascent version of my own engine played as well:

Code: Select all

    name                       perc.  pnt games  Buchh    S-B

 1. Binghewusi                  79% 166.0 /210  (21440.0, 16051.8)
 2. 3DChess                     72% 150.5 /210  (21595.0, 14230.3)
 3. Kou                         69% 144.5 /210  (21655.0, 13787.3)
 4. Swallow                     67% 140.0 /210  (21700.0, 13119.0)
 5. Cyclone                     65% 135.5 /210  (21745.0, 12437.5)
 6. Yssy                        64% 133.5 /210  (21765.0, 12303.3)
 7. Thought                     64% 133.5 /210  (21765.0, 12147.3)
 8. NymphChess                  60% 126.0 /210  (21840.0, 11241.0)
 9. Elephant Eye 3.1            59% 123.0 /210  (21870.0, 11457.8)
10. XQ Spirit                   57% 119.0 /210  (21910.0, 11039.8)
11. Jupiter                     55% 116.5 /210  (21935.0, 10483.8)
12. Blcx                        54% 112.5 /210  (21975.0, 10010.5)
13. HIce                        53% 111.5 /210  (21985.0, 9780.0)
14. Tlxj                        50% 105.5 /210  (22045.0, 9371.0)
15. Ultimate Fight              46%  96.0 /210  (22140.0, 8098.8)
16. Coony                       42%  89.0 /210  (22210.0, 7487.5)
17. Anita 0.2                   41%  85.5 /210  (22245.0, 7267.8)
18. HaQiKi D ae5                35%  73.0 /210  (22370.0, 5999.5)
19. HaQiKi D ae2                34%  71.0 /210  (22390.0, 5449.3)
20. Jiaolong fixed              26%  54.5 /210  (22555.0, 4153.0)
21. XQWLight                     9%  19.5 /210  (22905.0, 1215.5)
22. TJxiangqi                    2%   4.0 /210  (23060.0, 136.8)
In the mean time I found some more UCCI engines, and I still have some weaker engines as well (e.g. HoiXiangqi and my own MaxQi, and a few Qianhong 'plugins' that might be massaged to play the required time control), so we might get up to 30 engines.

July might be a good time to plan this.

If anyone is aware of more engines that can play under WinBoard, (or is planning to write one himself), please let me know!

It would be nice if this forum allowed posting of Xiangqi diagrams...
Stephan Vermeire (Brutus)
Posts: 34
Joined: Sun Oct 12, 2008 6:32 pm

Re: A good time to broadcast a Xiangqi tourney?

Post by Stephan Vermeire (Brutus) »

Hi Harm Geert,

Perhaps you should post a message in chinese as well? :wink:

I hope you get such a tourney started. It truely is a wonderful variant!
User avatar
Greg Strong
Posts: 388
Joined: Sun Dec 21, 2008 6:57 pm
Location: Washington, DC

Re: A good time to broadcast a Xiangqi tourney?

Post by Greg Strong »

That would be cool. I should add support to ChessV before the event. Wouldn't be difficult (to get it to play a reasonable game - making a strong engine is, of course, much more difficult.)
User avatar
phhnguyen
Posts: 1437
Joined: Wed Apr 21, 2010 4:58 am
Location: Australia
Full name: Nguyen Hong Pham

Re: A good time to broadcast a Xiangqi tourney?

Post by phhnguyen »

Greg Strong wrote:That would be cool. I should add support to ChessV before the event. Wouldn't be difficult (to get it to play a reasonable game - making a strong engine is, of course, much more difficult.)
To play a "simple" game, yes, you are right. But for a reasonable game - I think not easy.

Different from (normal) chess, the Xiangqi has a so complicated rule set and very hard to code program correctly (speciall for permanent chasing, checking problems)

For new commer's Xiangq programs, I guess that they will face to those problems for at least 1/2 total of their games.

The other problem the Winboard / XBoard should be "intelligent" enough to judge rules correctly, instead of using "local" rule set.
alpha123
Posts: 660
Joined: Sat Dec 05, 2009 5:13 am
Location: Colorado, USA

Re: A good time to broadcast a Xiangqi tourney?

Post by alpha123 »

phhnguyen wrote:The other problem the Winboard / XBoard should be "intelligent" enough to judge rules correctly, instead of using "local" rule set.
H.G.Mueller is the variant master, I'm sure that won't be an issue.... :)

Peter
User avatar
hgm
Posts: 27814
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: A good time to broadcast a Xiangqi tourney?

Post by hgm »

phhnguyen wrote:Different from (normal) chess, the Xiangqi has a so complicated rule set and very hard to code program correctly (speciall for permanent chasing, checking problems)

For new commer's Xiangq programs, I guess that they will face to those problems for at least 1/2 total of their games.

The other problem the Winboard / XBoard should be "intelligent" enough to judge rules correctly, instead of using "local" rule set.
Current XBoard / WinBoard is pretty good at implementing the Asia rules. If it is not perfect yet, I could fix it easily, if the ambiguity of the Asia rules could be clarified. The Asia rules are mainly specified through examples, and of some key dilemmas there are just no examples.

The most important issue that is not clear to me is if the chasing rues should be applied to repeat cycles that also contain checks, but cannot be declared a win for either side based on the checks alone. Like

[X] 4ka3/4a1rC1/9/9/9/9/9/9/9/9/4A4/3AK4 w

1. Ch9+ Rg9 2.Ch8 Rg8 3.Ch9+ ....

White has one check, one idle, which is allowed, but black is chasing the Cannon. So is this a loss for black?

One problem of applying the chasing rules in repeat loops that contain checks, is that the check disables most of your otherwise legal, existing moves (because you have to resolve the check in stead), and the check evasion then re-enables them. This might lead to very unnaturally looking chase rulings.

The difference is of practical significance: WinBoard currently does enforce chasing rules in loops with checks that would be draws based on the checks alone, but the chase detection of my engine did not. So I already ran into several games where WinBoad declared a loss for my engine when it was chasing as a side effect of one-check-one-idle.

Note that many of the engines I have actually do not pay attention to chasing at all, and are forfeited by WinBoard regularly now that my own engine does recognize it. (If both do not recognize it, and think it is draw, there will almost always be one that avoids it, because it thinks it is ahead.) So beginners don't have to worry too much about perpetual chasing. Perpetual checking is very important, though. But an approximate treatment where you rule a move that creates a repeat as a loss when it delivers check, and as a win when it evades a check, already solves most of the probem. (The correct way would be to test if all moves in the repeat loop are checks / evasions.)
User avatar
hgm
Posts: 27814
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: A good time to broadcast a Xiangqi tourney?

Post by hgm »

Greg Strong wrote:That would be cool. I should add support to ChessV before the event. Wouldn't be difficult (to get it to play a reasonable game - making a strong engine is, of course, much more difficult.)
While you are at it, perhaps you could also implement Makruk (Thai Chess). This should be totally trivial, it is very close to Shatranj (8x8 board, promotion to Ferz), the only difference being that the Elephant moves as a Shogi Silver, and promotion takes place already on 6th rank. I was surprised that ChessV did not have that implemented already (after I learned Makruk existed. :wink: ); it is one of the World's major Chess variants.
User avatar
Greg Strong
Posts: 388
Joined: Sun Dec 21, 2008 6:57 pm
Location: Washington, DC

Re: A good time to broadcast a Xiangqi tourney?

Post by Greg Strong »

hgm wrote:
Greg Strong wrote:That would be cool. I should add support to ChessV before the event. Wouldn't be difficult (to get it to play a reasonable game - making a strong engine is, of course, much more difficult.)
While you are at it, perhaps you could also implement Makruk (Thai Chess). This should be totally trivial, it is very close to Shatranj (8x8 board, promotion to Ferz), the only difference being that the Elephant moves as a Shogi Silver, and promotion takes place already on 6th rank. I was surprised that ChessV did not have that implemented already (after I learned Makruk existed. :wink: ); it is one of the World's major Chess variants.
Yeah, I skipped Xiangqi and Makruk because programs already existed; I was more focused on supporting more obscure variants. Makruk does have some strange end-of-game rule. Once the material on the board is reduced to certain levels, the clock starts ticking and the player with the larger army has a limited number of moves to secure victory (based on the specific pieces remaining) or the game is a draw. I haven't seen the list of specific material configurations with the maximum number of moves for each (although I haven't looked particularly hard.) Except for this, yes, Makruk support should be trivial.

Then, of course, there's Shogi, which would be amazingly hard. Because captured pieces can be dropped back into play, from mid-game on there are no quiescent positions ...
User avatar
hgm
Posts: 27814
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: A good time to broadcast a Xiangqi tourney?

Post by hgm »

Sure, Shogi is in a different class. (Would be nice to write a Shogi engine, though, especially now the ICGA Computer Olympiad is in Japan...)

I never studied the Makruk count-down rules carefully; my idea was that you could forget about them, just like you can forget about the 50-move rule in Chess.
User avatar
phhnguyen
Posts: 1437
Joined: Wed Apr 21, 2010 4:58 am
Location: Australia
Full name: Nguyen Hong Pham

Re: A good time to broadcast a Xiangqi tourney?

Post by phhnguyen »

hgm wrote: Current XBoard / WinBoard is pretty good at implementing the Asia rules. If it is not perfect yet, I could fix it easily,
You are expert!!!!!!
if the ambiguity of the Asia rules could be clarified. The Asia rules are mainly specified through examples, and of some key dilemmas there are just no examples.
I believe that both you and me (as well as some GM) don't really understand some of those rules. Some other rules we can understand but very hard to implement (such as detecting protected piece).

However, we can implement correctly 95% of all rules. For WB, an advantage/luck is that it doesn't have to care much about the search speed as normal engine. Thus, you have more chance to write the code.
The most important issue that is not clear to me is if the chasing rues should be applied to repeat cycles that also contain checks, but cannot be declared a win for either side based on the checks alone. Like

[X] 4ka3/4a1rC1/9/9/9/9/9/9/9/9/4A4/3AK4 w

1. Ch9+ Rg9 2.Ch8 Rg8 3.Ch9+ ....

White has one check, one idle, which is allowed, but black is chasing the Cannon. So is this a loss for black?
I am in office and can't not check the position now (I will check and answer you later). But from your description, I guess black loses IF Cannon is not protected.

One problem of applying the chasing rules in repeat loops that contain checks, is that the check disables most of your otherwise legal, existing moves (because you have to resolve the check in stead), and the check evasion then re-enables them. This might lead to very unnaturally looking chase rulings.

The difference is of practical significance: WinBoard currently does enforce chasing rules in loops with checks that would be draws based on the checks alone, but the chase detection of my engine did not. So I already ran into several games where WinBoad declared a loss for my engine when it was chasing as a side effect of one-check-one-idle.

Note that many of the engines I have actually do not pay attention to chasing at all, and are forfeited by WinBoard regularly now that my own engine does recognize it. (If both do not recognize it, and think it is draw, there will almost always be one that avoids it, because it thinks it is ahead.) So beginners don't have to worry too much about perpetual chasing. Perpetual checking is very important, though. But an approximate treatment where you rule a move that creates a repeat as a loss when it delivers check, and as a win when it evades a check, already solves most of the probem. (The correct way would be to test if all moves in the repeat loop are checks / evasions.)
Opps, you may need to study more Xiangqi games.

Both perpetual checking and chasing are very important, especial for computer sw. Perhaps one may focuse easily on checking than chasing a Pawn because the King is much more value than the Pawn. However, chasing may break the rule and should forfeit by a loss.

I see the chasing potently occures in at least 1/4 of total games and most of them one side would be lost if continues.

If WB always rules a chasing as a draw, I think there will not be fair games between a strong engine which knows that rule and a weak / newbie engine which does not install it and easily try to have a draw game or gain a piece by illegal chasing.

IMHO, implement Xianqi rules is one of the hardest problems and may take you a lot of time, effort.