Perpetual chasing in Xiangqi

Discussion of chess software programming and technical issues.

Moderators: Harvey Williamson, Dann Corbit, hgm

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
User avatar
hgm
Posts: 25386
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

Re: A method to implement Asian rule

Post by hgm » Sun Aug 22, 2010 4:52 am

OK, I agree that this is most likely what must be meant by the one who added this example to Asia rule. (But we are already on a dangerous path here, not taking the given examples at face value, but adapting them according to what we think they should have been, and then using them as if they were rule. An alternative approach would be to just ignore incorrect examples...)

In this modified Appendix 3 I have no problem explaining the draw without using any of the extra rules (1) or (2): white is perpetually chasing Ci8, alternately by Rf8 and Rd8, (two chasing one: forbidden.), and black is on all moves resolving the attack alternately by protecting Ci8 with Ca8 or blocking the Rd8 attack. Black is perpetually chasing Rd8 with Ci8, by moving the Advisor mount, and white is resolving it by moving the f-Rook mount.

So both are violating the rule (mutual perpetual chase, as the description says), which makes it draw.

That white is in addition chasing Ca8 with Rd8 by protection subversion is then no longer relevant, whether chase by protection subversion is considered a lesser violation than chasing by direct attack or not. Chasing two pieces simultaneously (as opposed to alternately) is not considered a worse offense than chasing one piece, and chasing a Cannon or Horse is not considered a lighter offense than chasing a Rook. White chases a Cannon by direct attack, and IMO there is no doubt whatsoever that he thereby is in violation of the most basic chasing rule.

Apart from the fact that the example was obviously wrong as given, I don't consider this a troublesome example at all.

User avatar
phhnguyen
Posts: 858
Joined: Wed Apr 21, 2010 2:58 am
Location: Australia
Full name: Nguyen Hong Pham
Contact:

Re: A method to implement Asian rule

Post by phhnguyen » Sun Aug 22, 2010 9:12 am

hgm wrote: In this modified Appendix 3 I have no problem explaining the draw without using any of the extra rules (1) or (2): white is perpetually chasing Ci8, alternately by Rf8 and Rd8, (two chasing one: forbidden.), and black is on all moves resolving the attack alternately by protecting Ci8 with Ca8 or blocking the Rd8 attack. Black is perpetually chasing Rd8 with Ci8, by moving the Advisor mount, and white is resolving it by moving the f-Rook mount.

So both are violating the rule (mutual perpetual chase, as the description says), which makes it draw.

That white is in addition chasing Ca8 with Rd8 by protection subversion is then no longer relevant, whether chase by protection subversion is considered a lesser violation than chasing by direct attack or not. Chasing two pieces simultaneously (as opposed to alternately) is not considered a worse offense than chasing one piece, and chasing a Cannon or Horse is not considered a lighter offense than chasing a Rook. White chases a Cannon by direct attack, and IMO there is no doubt whatsoever that he thereby is in violation of the most basic chasing rule.
I am still confuse about your explanation. Will think more to get your point.

BTW, did you see the similar between that Appendix and game 61? They have the same pattern: Cannon of 1st side - Rook of 2nd side - piece of 1st side - piece of 2nd side - Cannon of 1st side. But their results are different.

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

Re: A method to implement Asian rule

Post by hgm » Sun Aug 22, 2010 2:11 pm

That is not the pattern. The Cannon does not move. In 61 the Cannon move is not part of the loop, it is how you entered the loop. In Appendix 3 the Cannons do not move at all.

But both have a similar pattern, which is in fact shared by all chases by Cannon through mount moving: Move first piece (A) in Cannon line of fire(activate) - Move second piece (B) in line (block) - withdraw piece A (discovered attack) - withdraw mount B.

Only Cannons can easily make such static chases, because it requires two pieces to block, and withdrawing one then can enable the attack. With other pieces, to solve the threat you would either withdraw (and then he cannot attack you again with the samepiece without moving it) or you block (and then there is no reversible move that cn undo the blocking).

The crucial difference between A3 and 61 is that in 61 the Rook is not attacking the Ch2 on all moves. Only when you withdraw the Horse to clear the line between Ch2 and Rc2 des the Rook attack Ch2. When you interpose the Horse there is no attack on that Cannon. So that Cannon is not perpetually chased. That is what makes it different from A3. There you interpose a Rook, rather than a Horse, and that Rook des attack the Cannon.

User avatar
phhnguyen
Posts: 858
Joined: Wed Apr 21, 2010 2:58 am
Location: Australia
Full name: Nguyen Hong Pham
Contact:

Re: A method to implement Asian rule

Post by phhnguyen » Sun Aug 22, 2010 3:23 pm

hgm wrote:The crucial difference between A3 and 61 is that in 61 the Rook is not attacking the Ch2 on all moves. Only when you withdraw the Horse to clear the line between Ch2 and Rc2 des the Rook attack Ch2. When you interpose the Horse there is no attack on that Cannon. So that Cannon is not perpetually chased. That is what makes it different from A3. There you interpose a Rook, rather than a Horse, and that Rook des attack the Cannon.
Did you see that both games are chasing the Cannon on the left side? (If yes, do you mean now you believe that in A3 this is a "fair chase" - The victim side can attack back the attacker - the Cannon on the right side)? ;)

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

Re: A method to implement Asian rule

Post by hgm » Sun Aug 22, 2010 3:48 pm

Indeed, I did. But that is a chase by protection subversion, the staus of which is unclear, and needs to be resolved by extra rules (1), (2) or (3 = fair-chase concept).

The point is that no matter what the final solution for this ambiguity about protection subversion is, in A3 it does not matter, because red has a plain chase on Ca8. So red is chasing no matter what, and the case is an obvious draw. You will always get A3 right, even when you have not implemented chasing by protection subversion at all.

In 61, however, red is NOT chasing Ch2. So there the verdict depends crucially on how one treats the chasing by protection subversion of Cb2. It is draw because BOTH sides are chasing. Not because on side is chasing fairly and the other is not chasing at all.

User avatar
phhnguyen
Posts: 858
Joined: Wed Apr 21, 2010 2:58 am
Location: Australia
Full name: Nguyen Hong Pham
Contact:

Re: A method to implement Asian rule

Post by phhnguyen » Mon Aug 23, 2010 12:40 am

It seems that now we have the same understanding /explaining on almost all thing.

Let me clarify few details first:
hgm wrote:Indeed, I did. But that is a chase by protection subversion, the staus of which is unclear, and needs to be resolved by extra rules (1), (2) or (3 = fair-chase concept).

The point is that no matter what the final solution for this ambiguity about protection subversion is, in A3 it does not matter,
I totally agree. Actually so far we have agreed on 99.9% problems. Just take one more step if you are not so tired.
because red has a plain chase on Ca8. So red is chasing no matter what, and the case is an obvious draw. You will always get A3 right, even when you have not implemented chasing by protection subversion at all.
Do you mean chase Ci8? To compare with game 61, we mention about Cannon attacker on the right side.
In 61, however, red is NOT chasing Ch2. So there the verdict depends crucially on how one treats the chasing by protection subversion of Cb2. It is draw because BOTH sides are chasing. Not because on side is chasing fairly and the other is not chasing at all.
Can you re-check this game? This is a win of Black side (0-1).

Now let me "nail" some points which we have the same view / understanding:

I) Chased pieces in some games
- Both games 61 and A3 are chasing the Cannon on the left side.
- In A3 (the re-edited version), both Cannons Ca8, Ci8 and Rook Rd8 are being chased.
- In 61, the Cannon Cb2 and Rook Rc2 are being chased

II) Score the chase
1) You score the chase on a piece which is protected by subversion less violation than other kinds of chasing. The evaluation work as following:

Code: Select all

If (all chased pieces are subversion chases) 
  score for attacker side as less violation score (lower score);
else /* there is at least one chased piece is not subversion chase */
  score the attacker side as normal score;
2) Because I don't treat subversion chase as a special one. Instead I will find and score any chase in which a Rook is being chased by smaller piece and then check if the Rook side can attack back the attacker. The evaluation works as following:

Code: Select all

If (there is a smaller piece chasing a Rook && the Rook side can not attack that smaller piece)
  score for attacker side as more violation score (higher score);
else
  score the attacker side as normal score;
Do you have any fixing or idea on above points?

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

Re: A method to implement Asian rule

Post by hgm » Mon Aug 23, 2010 4:18 am

phhnguyen wrote:Do you mean chase Ci8? To compare with game 61, we mention about Cannon attacker on the right side.
...
Can you re-check this game? This is a win of Black side (0-1).
Indeed these are errors, sorry. I had not typed what I meant to say. The first case should indeed be Ci8. In the second, I was referring to the A3 game, not 61.
I) Chased pieces in some games
- Both games 61 and A3 are chasing the Cannon on the left side.
- In A3 (the re-edited version), both Cannons Ca8, Ci8 and Rook Rd8 are being chased.
- In 61, the Cannon Cb2 and Rook Rc2 are being chased

II) Score the chase
1) You score the chase on a piece which is protected by subversion less violation than other kinds of chasing. The evaluation work as following:

Code: Select all

If (all chased pieces are subversion chases) 
  score for attacker side as less violation score (lower score);
else /* there is at least one chased piece is not subversion chase */
  score the attacker side as normal score;
Indeed, this is my solution (1). Solution (2) would be more strict. It would count subversion chases as equal violations to firect-attack chases, but in case of a subversion chase, it would apply an extra test (on move by move basis):

a) is the subverted protector a Cannon?
b) is there a Rook amongst the (static) chasers?
c) is this Rook attacked by the subverted protector before the move?
2) Because I don't treat subversion chase as a special one. Instead I will find and score any chase in which a Rook is being chased by smaller piece and then check if the Rook side can attack back the attacker. The evaluation works as following:

Code: Select all

If (there is a smaller piece chasing a Rook && the Rook side can not attack that smaller piece)
  score for attacker side as more violation score (higher score);
else
  score the attacker side as normal score;
Do you have any fixing or idea on above points?
c . c . k . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
P . P . . . . . .
h . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . R K . . . . .

1.Ra0 Hc2 2.Rc0 Ha3 3.Ra0

If I understand you correctly, you would score this one as a red win, because the Cannons are Chasing the Rook, and the Rook cannot chase them back, but chases the Horse in stead?

User avatar
phhnguyen
Posts: 858
Joined: Wed Apr 21, 2010 2:58 am
Location: Australia
Full name: Nguyen Hong Pham
Contact:

Re: A method to implement Asian rule

Post by phhnguyen » Mon Aug 23, 2010 6:10 am

hgm wrote: Indeed, this is my solution (1). Solution (2) would be more strict. It would count subversion chases as equal violations to firect-attack chases, but in case of a subversion chase, it would apply an extra test (on move by move basis):

a) is the subverted protector a Cannon?
b) is there a Rook amongst the (static) chasers?
c) is this Rook attacked by the subverted protector before the move?
I am very happy that until now we have agreed almost every thing!

The last difference of using (1) and (2) is not really problem at all because I see they both are reasonable and can work well and give us same results.

I will implement them both to test further if there is any tricky as well as comparing performance of them (of course they depends much on the structure of a program).

Hope that we have completed main discussion / debate here and now will focus on technical implementation as well as optimizing.

c . c . k . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
P . P . . . . . .
h . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . R K . . . . .

1.Ra0 Hc2 2.Rc0 Ha3 3.Ra0

If I understand you correctly, you would score this one as a red win, because the Cannons are Chasing the Rook, and the Rook cannot chase them back, but chases the Horse in stead?
I am not sure about that game because the move 2. Rc0 is illegal when Red is in check (by 1... Hc2). So I have modified the board and whole game as the following:


[Event "Edited game"]
[Site "TONYPHAM"]
[Date "2010.08.23"]
[Round "-"]
[White "-"]
[Black "-"]
[Result "1-0"]
[Variant "xiangqi"]
[FEN "c1c1k4/9/9/9/9/P1P6/h8/9/9/2R2K3 w 0 1"]
[SetUp "1"]

{--------------
c . c . k . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
P . P . . . . . .
h . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . R . . K . . .
white to play
--------------}
1. Ra0 Hc2 2. Rc0 Ha3 3. Ra0 Hc2 4. Rc0 Ha3
{Xboard adjudication: perpetual chasing} 1-0


I have no problem with that game. Both side are chasing. The Red Rook is chasing Black Horse which is protected - allowed. In the same time two Cannons are chasing that Rook but the Red can't attack back so not allowed. Red wins (1-0), similar to Xboard.

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

Re: A method to implement Asian rule

Post by hgm » Mon Aug 23, 2010 7:02 am

OK, forget about that last example. I had not realized the Horse was protected. I guess this is unavoidable for a piece that must uncover an attack. But I can still adapt it to show what I had in mind:

Code: Select all

. c c . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. P C P . . . . .
. . . . . . . . .
. . r . . . . . .
H R . H . . . . .
. . . . . . . . .
I replaced the Horse as chase target by a Rook. Because R on (protected) R chases are still not possible, I added two white Horses to deliver discovered attacks on that Rook:

1.Rc1 Rb2 2.Rb1 Rc2 3.Rc1 ...

Now white is chasing a Rook with two Horses. It does not matter that the Rook is protected by the Cannons, and it does not matter that at the same time I offer to exchange (or sacrifice) my own Rook against it. It is a clear violation by direct attack. The black Rook can attack the Horses that chase it, though.

OTOH, black is chasing the white Rook with his two Cannons, also through direct (discovered) attack. It is not possible for black to counter-attack the Cannons with his Rook. So this is a clear chase, and in your terminology it would be an un-fair chase.

So with your rules, white would be ruled to win. In either of my rules, t would be draw.

When you would replace Pb4 and Cc4 by black Pawns, a counter attack on the Cannons would be possible, and your rules would also grant a draw. But I think that it is highly undesirable that it makes a difference what the Cannon mounts are. Having to capture a defended Pawn with a Rook can hardly be called an acceptable way out..

User avatar
phhnguyen
Posts: 858
Joined: Wed Apr 21, 2010 2:58 am
Location: Australia
Full name: Nguyen Hong Pham
Contact:

Re: A method to implement Asian rule

Post by phhnguyen » Mon Aug 23, 2010 7:40 am

I am very lazy to "run" algorithm without program, so I have to create the full game as the following. Tell me and modify the game if you don't satisfy:


[Event "Edited game"]
[Site "PHAM"]
[Date "2010.08.23"]
[Round "-"]
[White "-"]
[Black "-"]
[Result "1/2-1/2"]
[Variant "xiangqi"]
[FEN "1cc1k4/4a4/9/9/1PCP5/9/9/2r6/HR1HA4/5K3 w 0 1"]
[SetUp "1"]

{--------------
. c c . k . . . .
. . . . a . . . .
. . . . . . . . .
. . . . . . . . .
. P C P . . . . .
. . . . . . . . .
. . . . . . . . .
. . r . . . . . .
H R . H A . . . .
. . . . . K . . .
white to play
--------------}
1. Rc1 Rb2 2. Rb1 Rc2 3. Rc1 Rb2 4. Rb1 Rc2
{XBoard adjudication: repetition draw} 1/2-1/2

According to my program, both are chasing:
- White is chasing Black Rook (with is protected) using both Rook and Horse. The problem here Horse chases Rook but does't get any attack back (not fair). The chaseScoreW is set to 2 - highest violence.
- Black is chasing White Rook, using Cannons which are not be attacked back (not fair). chaseScoreB is set to 2 too.

Because both sides have the same violent level of 2 - Draw.

Post Reply