A good time to broadcast a Xiangqi tourney?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
hgm
Posts: 27794
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: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.
But fortunately WB does already much better than that. The current stable version in fact gives correct ruling for all 104 examples given with the Asia rules on www.clubxiangqi.com . It also follows your interpretation of the rules that chasing is illegal even when checking. (So I will have to change that in my engine.) Only in the "Appendix" to these rules there is an example it des not agree with. This is an odd-ball case, where periodiclly subverting and restoring the protection of a piece is ruled as a chase of tht piece by another, non-moving Rook. This is difficult to implement, as it is not clear how the concept of a perpetual sacrifice should be extended to a case where you subvert the protection, rathere than attacking the piece itself. And it seems extremely rare anyway.
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.
Indeed, WB uses very inefficent code for detecting move legality, in check, etc., which would be completely inacceptable in an engine. The chase-detection code I hve written is similar in spirit. I just run the legal-move generator a number of times, with different call-backs: first after the move to list all captures, then before the move, to eliminate all captures that already existed, then to test the legality of a reverse capture ('sacrifice / offer to exchange') and to find a legal recapture (for determining protection), where applicable.

In fact I now do approximately the same in my engine (except that the check-test to verify move legality is done a little more efficiently than just generating all opponent moves), because I wanted to worry about efficiency only after establishing how important the problem was. Currently I address the efficiency problem by only doing the chase test when the remaining search depth > 2.
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.
OK, this is the imterpretation that WB uses also. I was in doubt, because checks and chases are in a different class (if A perpetually checks, and B perpetually chases a Rook, A is ruled to lose, while A chasing a Rook and B chasing a Horse would be ruled draw).

Loops with checks in it do raise other problems for chase determination, though: being in check makes most of your pseudo-legal moves illegal, to come back after you resolve the check. Should such enabling of an attack by changing your in-check status be counted as a chase?
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.

IMHO, implement Xianqi rules is one of the hardest problems and may take you a lot of time, effort.
My statement was based on the test gauntlets I play with my engine: To evaluate a change I typically play 500 40/1 games and 400 40/2 games, 100 per opponent. Against opponents without chase detection I tipycally find 10 games of the 100 end in a forfeit by chasing.
User avatar
hgm
Posts: 27794
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 »

An exmple of what I mean is this:

[X] c4kH2/6r2/9/2H1cp3/9/P8/9/4E4/4A4/3AK4 w

1. He7+ Re8 2.Hc6 Rg8 3.He7+ ...

Wite (red) has one check, one idle (allowed), and if we then apply chasing rules one chase (on the Rg8) and one idle (also allowed). Black, however, has one chase (on Hg9 with Rg8), and arguably another chase on Hg9 with Ca9: before black plays Re8 he cannot capture Cxg9 (because that would leave him in check by He7), and after resolving the check with Re8 he can (if it were his move). Two chases on the same unprotected piece would be a in violation of the chase rule, so black could be ruled to lose then.

On the one hand it seems unnatural to consider Re8 a chase on Hg9 by Ca9, as none of these pieces did anything active. But on the other hand, I think the examples with the Asian rules clearly indicate that similar situations (unpinning a Cannon that does not move, or blocking the protector of a Horse that does not move) would be ruled a chase, so why not here?
User avatar
hgm
Posts: 27794
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 »

The latest version of HaQiKi D (1.3) really starts to look like a decent engine. I added it to the UCCI round robin by playing a gauntlet. LMR really gives a boost in Xiangqi. Before, I was simply out-searched by almost every engine. I also fixed many deficiencies that did not affect playing strength, or hardly so. E.g. it prints the PV now, and moves instantly when there is only a single legal move (which in XQ happens very often).

Main thing that is still lacking now is a good evaluation. (Difficult for me, as a non-player...) The top engines now do not outsearch me anymore (unless they ly about depth), but profit from the strategic weakness of HaQiKi D (which often puts itself in an unsolvable pin situation, manoeuvres its Cannons and Horses in corners from which they cannot escape, and seems annoyingly poor in deciding if leaving the opponent an extra Pawn makes the difference between a draw and a loss.

Code: Select all

    name                       perc.  pnt games  Buchh    S-B

 1. Binghewusi                  78% 172.5 /220  (23575.0, 17512.0)
 2. 3DChess                     72% 159.0 /220  (23710.0, 15855.5)
 3. Kou                         69% 152.5 /220  (23775.0, 15333.8)
 4. Swallow                     66% 145.5 /220  (23845.0, 14321.5)
 5. Cyclone                     64% 140.5 /220  (23895.0, 13557.8)
 6. Thought                     64% 140.5 /220  (23895.0, 13495.5)
 7. Yssy                        63% 138.5 /220  (23915.0, 13422.8)
 8. Elephant Eye 3.1            60% 131.0 /220  (23990.0, 12879.8)
 9. NymphChess                  59% 129.5 /220  (24005.0, 12127.3)
10. HaQiKi D 1.3                57% 124.5 /220  (24055.0, 11695.8)
11. XQ Spirit                   56% 123.5 /220  (24065.0, 12064.0)
12. Jupiter                     55% 120.5 /220  (24095.0, 11393.5)
13. Blcx                        53% 117.5 /220  (24125.0, 11021.8)
14. HIce                        53% 117.5 /220  (24125.0, 10911.5)
15. Tlxj                        50% 109.5 /220  (24205.0, 10243.8)
16. Ultimate Fight              45%  98.0 /220  (24320.0, 8676.3)
17. Coony                       42%  93.5 /220  (24365.0, 8345.5)
18. Anita 0.2                   39%  86.5 /220  (24435.0, 7686.0)
19. HaQiKi D ae5                34%  75.5 /220  (24545.0, 6536.8)
20. HaQiKi D ae2                33%  73.5 /220  (24565.0, 5977.3)
21. Jiaolong fixed              26%  57.0 /220  (24730.0, 4630.0)
22. XQWLight                     9%  19.5 /220  (25105.0, 1264.3)
23. TJxiangqi                    2%   4.0 /220  (25260.0, 138.5)
I wonder if I should start treating chases in the same way as we normally treat checks, i.e. give an extension for it. A check extension is generally found to be useful, because it makes it more difficult to use checks to push things over the horizon, and thus makes the search more stable. But chases have the same effect: usually you will fail low unless you save the hanging or valuable piece. So in stead of having a 1-bit inCheck flag, one could maintain a word of 16 inCheck/inChase flags; one for each piece. Like one usually uses a different move generator for check evasions (e.g. legal in stead of pseudo-legal), it might be possible to improve the search efficiency by using a different move sorting when 'in chase', sorting potential non-capture solutions (such as withdrawing, blocking or defending) before (some of the) captures.

Problem is of course that finding out if a move chases is even more expensive than finding out if it checks: in checking it is not relevant if the King is protected, or not.
User avatar
hgm
Posts: 27794
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 »

I adapted my ChessLive! viewer to handle Xiangqi. I had to iron out a bug in connection with e.p. capture (the side-way moves of Pawns across the River were interpreted by WinBoard as such, and wrongly transmitted to the viewer, making other pieces disappear from the viewer board), and an earlier bugfix apparently broke the transmission of engine scores, but fixed that in WinBoard, and now everything seems to work correctly.

So I guess we are definitely 'on' for a tourney in July.

The viewer page should already be visible at http://80.100.28.169/xq/oriental.html . Currently no games are going on, so that you would just see the last test game I played there (between HaQiKi D and EyChessU).
TonyJH
Posts: 183
Joined: Tue Jun 20, 2006 4:41 am
Location: USA

Re: A good time to broadcast a Xiangqi tourney?

Post by TonyJH »

The viewer looks good. I'd like to send you a new version of TJxiangqi with a bug fix for your tourney. It will still be weak, though. :)
liuzy

Re: A good time to broadcast a Xiangqi tourney?

Post by liuzy »

Cann't find any GUI can run HaQiKi easily.
Why not support UCCI formally, since HaQiKi in fact supports it.
User avatar
hgm
Posts: 27794
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 »

WinBoard / Xboard does run HaQiKi D without any problems or complications. In fact the standard binary install of WinBoard 4.4.3 comes with HaQiKi D 0.8 pre-installed (optionally). People that want a newer version only have to replace the executable.

I will be running this tournament under WinBoard + PSWBTM anyway, in order to be able to broadcast the games over the internet.
User avatar
hgm
Posts: 27794
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 »

TonyJH wrote:The viewer looks good. I'd like to send you a new version of TJxiangqi with a bug fix for your tourney. It will still be weak, though. :)
Great! Don't worry: I will also enlist engines that are still far weaker (MaxQi, VSCCP, HoiXiangqi). I will probably set it up as a division system: slice up the field in groups of 8, in which I will do a round-robin, and then merge the lower half of each group with the top half of the lower one in a second round of round-robins (with a playoff competition of 4). Perhaps I will even repeat that a number of times.
User avatar
hgm
Posts: 27794
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 »

The following might be a nice tournament setup:

Start with 4 classes (A-D) of 8 engines each, more or less segregated by strength. (I.e. the strongest would go into A, the weakest in D.) Then play a full round-robin (56 games) in each class.

After this preliminary round, re-group the engines such that four go into a play-off group, which plays a round-robin with 8 games per pairing (48 games), and groups of eight, basically by combining the lower half of one class with the upper half of the class below it. Except that the number one and number last of each class would move up or down two classes. These would again play a full round-robin (56 games).

So:
playoffs: A1, A2, A3, B1
runner-up: A4, A5, A6, A7, B2, B3, B4, C1
3rd group: A8, B5, B6, B7, C2, C3, C4, D1
4th group: B8, C5, C6, C7, C8, D2, D3, D4
red-lantern: D5, D6, D7, D8
User avatar
hgm
Posts: 27794
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 »

I have the following tentative field in mind:

Class A:
1. 3DChess
2. Binghewusi
3. BugCChess
4. EyChessU
5. Kou
6. Swallow
7. TMSK (???)
8. Yssy

Class B:
1. Cyclone
2. Elephant Eye
3. HaQiKi D
4. Jupiter
5. NymphChess
6. Thought
7. Ultimate Fight
8. XQ Spirit

Class C:
1. Anita
2. Blcx
3. Coony
4. Folium
5. HIce
6. Jiaolong
7. MRSD
8. Tlxj

Class D:
1. XQWLight
2. TJxiangqi
3. MaxQi
4. ChessV (???)
5. VSCCP
6. HoiXiangqi
7. Tsito
8. Qianhong

I hope that Gregory can manage to program Xiangqi into ChessV before July. I am not sure about TMSK; I would like to have an entry from Taiwan, but currently it does not support UCCI or WinBoard protocol. I hope the authors are willing to consider supporting it for this occasion.