Perpetual chasing in Xiangqi

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

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

Re: A method to implement Asian rule

Post by hgm »

Indeed, IMO this is an inconsistency in Asia rule. In the second example, white cannot protect the Horse (from that direction by R or C) against capture by the black Rook, without also attacking that Rook. Similarly, solving the attack on the Rook will also subvert the protection of the Horse.

So I agree, if subverting protection is considered chasing, as the Appendix chase tells us, this looks like a mutual chase. Yet it is explicitly mentioned as a chase. The original (translated) text said:
19. When a Rook cannot move because of an opponent's Knight, the Rook cannot be perpetually chased, regardless of whether the opponent's Knight is protected. (See examples in Diagram 39, 40, and 41)

Explanation:
In Diagrams 39, 40, and 41, the Red Knight is not protected but because the Black Rook doesn't move, it is not considered as a perpetual chase. On the contrary, each of the Red moves attacks the Black Rook and this is a violation of the rule. Red has to change.
(Emphasis mine.) Apparently they later had second thoughts about this guide line, as they added the Appendix chase, where the fact that the Rook does not move is suddenly NOT reason to disqualify it as a chase anymore. There it says:
Explanation:
Red keeps moving its Pawn to keep the Black Knight "unprotected". This constitutes the Red Rook perpetually chasing the unprotected Black Knight. Red is violating the rule.
While in this case, the Rook is also statically attacking the Horse, and the Horse is pinning it! The only difference between diagrams 39-41 and the Appendix is that in the Appendix the protecting Cannon acts from the side, i.e. along a ray not intersecting the Rook.

If we take this seriously, the conclusion must be that you re not allowed to chase by subverting protection if the opponent is idle, but that counter-chasing by protection subversion while you are being chased apparently is not a reason to call it a draw by mutual chasing. This can be generalized into a rule in two ways:

1) Chasing by protection subversion is a lesser offense than chasing by direct attack. (Just like chasing is a lesser offense than checking.) So there are actually three levels of perpetuals: checking, chasing and unprotecting. Only when both sides do not violate the higher rule, one starts worrying about the next lesser rule. If both sides violate a rule at the same level, it is draw.

2) This is a special exception that must be generalized as little as possible, just as CxR and HxR attacks are explicitly mentioned as exceptions to the rule that you can chase protected pieces, which must not be generalized to think that ExR or AxR attacks on a protected Rook should count as chasing. (However ridiculous it might be that you let the protection make any difference in these cases...) Rule 19 says you cannot chase a Rook pinned by a Horse, even if the opponent counter-chases the pinning Horse. It is some sort of extra protection of Rooks, in particular pinned Rooks.

Take this one:

Code: Select all

9 . . c . . . . . .
8 . . . . . . . . .
7 . . . . . . . . .
6 . R . . . . . . .
5 . . . . . . . . .
4 . . h . . . . . .
3 . . . . . . . . .
2 . . . . . . . . .
1 . . h R . . . . .
0 . . . . K . . . .
  a b c d e f g h i
1.Rc6 Ha5 2.Rb6 Hc4 3.Rc6 ...

The same situation as the Appendix chase, where in this case the moving mounts are white R and black H. But now, at the same time, the black H is chasing the white R.

In interpretation (1), this now should be a win for white, as the chasing of the white Rc6/b6 by direct H attack violates a more important rule than the chasing of Hc1 though subversion of its protection.

In interpretation (2) it would be draw due to mutual chasing, as the subversion of the protection of Hc1 was not a side effect of solving an attack on the Rook that it pinned, and is thus not covered by rule 19.

Now the first example. This is also a bit troublesome, because as it was originally given, it was alternately moving the d- and f-Rooks, with the effect that you alternately chase different Cannons, which is of course always allowed:
Example of Mutual Perpetual Chase
R4-2 g4+5
R4+2 g5-4
R6-4 g4+5
R6+4 g5-4
R4-2 g4+5
R4+2 g5-4
R6-4 g4+5
Now I took the liberty to replace this by moves of the same Cannon in the PGN file, just interpreting it as one other typo amongst the many in the original document. (The quality is really appalling: diagrams are missing, wrong diagrams are posted, typos in moves...) The fact that a scanned book on Asia rules omits this diagram is also an indication that people discovered at some point there is something wrong with it.

But when only moving the f-Rook, it becomes a non-trivial case again.

Rf6 is a chase. It enables Rd8xi8. That before it could capture that Cannon itself is never an excuse in Asia rules: chases are attacker-specific. It just means that Rf8/f6 cannot be accused of chasing Ci8 on this move, but the other Rook can, and two chasing one is still forbidden. After the move Rd8xi8 has become possible, and no recapture is possible. So chase by Rd8 on Ci8.

Af9-e8 blocks Rd8xi8. So it satisfies the condition that black resolves the chase. As a side effect Ci8 now attacks Rd8.

On the second move Rf8 attacks Ci8 again, and the latter is still unprotected. Black resolves it by protecting it: after Ae8-f9, Rf8xi8 can be refuted by Ca8xi8. So again the three conditions for a chase are satisfied: the capture of an unprotected piece (with this attacker) was not possible before the move, became possible after the move, and became again impossible after the move.

A side effect of Af9 is that Ci8 now attacks Rd8. So this Rook is also chased, alternately by Ca8 and Ci8. Two chasing one is forbidden. (That Ca8xf8 is also made possible by Ae8-f9 has no consequences, as Rf8 is not attacked in the other move.)

What makes this 'corrected' diagram a bit muddy, is that the chase of Ci8 through Rf6 both creates the attack on it (discovering the attack of Rd8), as well as subverts the protection of it. I guess this means it is a violation of both rules. This means that Ci8 is continuously chased by direct attack, though, and not by (possibly lower ranking) protection subversion.

Further note that Ca8 is being chased by Rf6 through protection subversion, despite the fact that both are completely static. The moving of Rf8 and Ae8 as mounts for Ci8 do chase Rd8, but at the same time protect Ca8 from this Rd8. This is the usual situation when you protect a piece by 'X-rays' through an enemy attacker, similat to that in diagrams 39-41. Difference here is that Ca8 is not a Horse pinning Rd8, so that rule 19 does not apply, and that you had a chase by direct attack on Ci8 already, so that it is really immaterial what you do to Ca8.

Of course my initial reaction to this mess was NOT to take it seriously. It was, after all, only an appendix, and it had all the looks of something that was added without thinking it through by a rather incompetent person. And it suited me fine to not recognize chasing by protection subversion as chasing at all. This makes the repeat adjudication in my engine very much simpler, and it never seems to occur anyway...
User avatar
phhnguyen
Posts: 1434
Joined: Wed Apr 21, 2010 4:58 am
Location: Australia
Full name: Nguyen Hong Pham

Re: A method to implement Asian rule

Post by phhnguyen »

hgm wrote:
1) Chasing by protection subversion is a lesser offense than chasing by direct attack. (Just like chasing is a lesser offense than checking.) So there are actually three levels of perpetuals: checking, chasing and unprotecting. Only when both sides do not violate the higher rule, one starts worrying about the next lesser rule. If both sides violate a rule at the same level, it is draw.
This point seems to be good to me. I will check if it could explain all cases.

2) This is a special exception that must be generalized as little as possible, just as CxR and HxR attacks are explicitly mentioned as exceptions to the rule that you can chase protected pieces, which must not be generalized to think that ExR or AxR attacks on a protected Rook should count as chasing. (However ridiculous it might be that you let the protection make any difference in these cases...) Rule 19 says you cannot chase a Rook pinned by a Horse, even if the opponent counter-chases the pinning Horse. It is some sort of extra protection of Rooks, in particular pinned Rooks.

Take this one:

Code: Select all

9 . . c . . . . . .
8 . . . . . . . . .
7 . . . . . . . . .
6 . R . . . . . . .
5 . . . . . . . . .
4 . . h . . . . . .
3 . . . . . . . . .
2 . . . . . . . . .
1 . . h R . . . . .
0 . . . . K . . . .
  a b c d e f g h i
1.Rc6 Ha5 2.Rb6 Hc4 3.Rc6 ...

The same situation as the Appendix chase, where in this case the moving mounts are white R and black H. But now, at the same time, the black H is chasing the white R.
The rule 19 is not enough for other cases. Take a look at the following example of Asia rules. Black Rook is not pinned and chasing Cb2 if we count the attack of other C as a protection.


[Event "Asia rules 26"]
[Site "FOM-RHKA8J2A5WY"]
[Date "2010.05.07"]
[Round "61"]
[White "-"]
[Black "-"]
[Result "0-1"]
[Variant "xiangqi"]
[FEN "3akaeC1/9/4e4/r3p4/p1p6/4P4/P1P5h/HCr1E4/4A4/R2AK1E2 w 0 1"]
[SetUp "1"]

Code: Select all

{--------------
. . . a k a e C .
. . . . . . . . .
. . . . e . . . .
r . . . p . . . .
p . p . . . . . .
. . . . P . . . .
P . P . . . . . h
H C r . E . . . .
. . . . A . . . .
R . . A K . E . .
white to play
--------------}
{--------------
. . . a k a e C .
. . . . . . . . .
. . . . e . . . .
r . . . p . . . .
p . p . . . . . .
. . . . P . . . .
P . P . . . . . h
H C r . E . . . .
. . . . A . . . .
R . . A K . E . .
white to play
--------------}
1. Ch2 Hg2
(1... Rxb2 2. Cxb2)
2. Eg4
( 2. Ei2 Rxb2)
2... He3
(2... Rxb2 ( 2. Ei2 Rxb2)
3. Cxb2)
3. E0e2
( 3. Ci2 Rxb2)
3... Hg2 4. Eg0 Hf4 5. E0e2 Hg2 6. Eg0
{The Cannon chases the Rook, despite the fact
that neither moves. That the black Rook constantly
attacks a Cannon of which the protection is subverted
does not alter that.}

0-1


In interpretation (1), this now should be a win for white, as the chasing of the white Rc6/b6 by direct H attack violates a more important rule than the chasing of Hc1 though subversion of its protection.

In interpretation (2) it would be draw due to mutual chasing, as the subversion of the protection of Hc1 was not a side effect of solving an attack on the Rook that it pinned, and is thus not covered by rule 19.
For me, White win seems be a fair result. I agree that H chase is more direct and clearer than the chase of R.
Rf6 is a chase. It enables Rd8xi8. That before it could capture that Cannon itself is never an excuse in Asia rules: chases are attacker-specific.
The idea of attacker-specific chasing seems to bring more problem than solve them. For example, the part of a game as below:

Code: Select all

9 . . . . . . . . . 
8 . . . . . . . . . 
7 . . . . . . . . . 
6 . . r . . . . . . 
5 . . . . . . . . . 
4 . . R . . . . . . 
3 . . P . . . P . . 
2 . . C . . . C . . 
1 . . . . . . . . . 
0 . . . . . . . . . 
  a b c d e f g h i 
1) Rf4 Rf6 2) Rc4 Rc6

Do you think White is chasing Black Rook or that is a "sacrifice" or an "offer xchange" from Black?
User avatar
hgm
Posts: 27787
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: A method to implement Asian rule

Post by hgm »

OK, thank you for pointing out this case. I had not noticed the "chase by protection subversion" there.

So it seems being pinned is not a necessary condition for a chase-by-attack vs chase-by-unprotect to be ruled a loss for the chase-by-attack. One could still argue, though, that rule 19 and diagram 61 share the characteristic that the unprotecting is a side effect of resolving the attack on your Rook, which is unavoidable when the protector protects the target 'through' a Rook attacker.

So rather than giving a lower status to chase-by-unprotect, there could be a rule that one is allowed to unprotect a piece attacked by a Rook when the pprotector was also attacking the Rook, and you solve the attack on that Rook. That interpretation would imply the H chases R (by attack) vs R chases H (by unprotect) would be a draw due to mutual chase.

So it is a hard choice. Basically, we would be extending Asia rule in a non-obvious, and possibly controversial way.

Making chase-by-unprotect a 'third-rank violation' has the advantage that it becomes than easier to make the next step, "so let's forget about it completely", which makes chase detection in engines a lot simpler and less costly. (We could call it "Europe rules" :P ) Adhering to interpretation (2),on the other hand, would make it even more complicated to do chase testing, as you would have to test for this exception, of subverted protector attacking the static chaser, when the latter is a Rook.

I suppose the last case you mention should have 1.Rg4 Rg6 in stead of 1.Rf4 Rf6. I think this clearly falls under the case of rule 36.
If a move in a perpetual chase is an offer to exchange, it still constitutes a perpetual chase. If every move in a perpetual chase is also an offer to exchange, it still constitutes a perpetual chase. (See examples in Diagrams 90 to 93)
Diagrams 92 and 93 show cases where the offer to exchange a Rook goes accompanied by activating an attack of C or H on that Rook. This is defined as chase. So I would say that activating an attack of C on R by withdrawing the R would also be chase. Wheter a chased piece is statically attacked by another piece never makes a difference in Asia rule either. I think the practical importance of that idea is that if it would be good to cpture with the static attacker, you would simply do it, rather than chase. That you bring in a new attacker, must mean it is somehow not attractive to capture with the static one. So the new attack is relevant, and a consciuos attempt to keep the opponent perpetually busy srescuing the attacked piece, and thus should be penalized. (e.g. place extra Rooks on i4 and i5, and Rxc6 would not accomplish anything.


The black attacks on the white Rook are offers to exchange / sacrifices, and thus allowed.
User avatar
phhnguyen
Posts: 1434
Joined: Wed Apr 21, 2010 4:58 am
Location: Australia
Full name: Nguyen Hong Pham

Re: A method to implement Asian rule

Post by phhnguyen »

hgm wrote: Making chase-by-unprotect a 'third-rank violation' has the advantage that it becomes than easier to make the next step, "so let's forget about it completely", which makes chase detection in engines a lot simpler and less costly. (We could call it "Europe rules" :P )
Let discuss more, I think when we have some agreement, because some of us from Europe, America, some others from Australia / Asia, we can call it by a little better name: "Xiangqi World rules" :wink:
I suppose the last case you mention should have 1.Rg4 Rg6 in stead of 1.Rf4 Rf6. I think this clearly falls under the case of rule 36.
If a move in a perpetual chase is an offer to exchange, it still constitutes a perpetual chase. If every move in a perpetual chase is also an offer to exchange, it still constitutes a perpetual chase. (See examples in Diagrams 90 to 93)
Diagrams 92 and 93 show cases where the offer to exchange a Rook goes accompanied by activating an attack of C or H on that Rook. This is defined as chase. So I would say that activating an attack of C on R by withdrawing the R would also be chase. Wheter a chased piece is statically attacked by another piece never makes a difference in Asia rule either. I think the practical importance of that idea is that if it would be good to cpture with the static attacker, you would simply do it, rather than chase. That you bring in a new attacker, must mean it is somehow not attractive to capture with the static one. So the new attack is relevant, and a consciuos attempt to keep the opponent perpetually busy srescuing the attacked piece, and thus should be penalized. (e.g. place extra Rooks on i4 and i5, and Rxc6 would not accomplish anything.


The black attacks on the white Rook are offers to exchange / sacrifices, and thus allowed.
I did not see the similar between my example and Diagrams 90 to 93. As I understand, in Diagrams 90 to 93, there are multi attackers to the victim and since one of attackers is not allowed, White is ruled as the chase.

In my example, when Black Rook is offering a sacrifice, White has only one to attack back to that Rook. The problem happens only when White tries to escape that offer and then activate the attack from Cannons (kind of side affect). I think we can apply the conclusion in the Diagram 91 that attacks of those Cannons are not relevant - Draw.

However, if we consider the attacks of White as attacker-specific, the move of White is not the attempt to escape the sacrifice offer but the attack / chase from Cannons - White loses.
User avatar
hgm
Posts: 27787
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: A method to implement Asian rule

Post by hgm »

I think this is a clear chase. Why should it be not ruled a chase? White is creating direct attacks on the black Rook, and CxR is always chase. Black is forced to react, or lose a Rook. This is exactly what the chasing rule is supposed to protect him from.

So I don't see why you think this is special. What if it was another piece that was unblocking the Cannon attacks, say a (defended) Horse (after shifting the g-file to the e-file)... Would you think it was a chase then?

That black is sacrificing its Rook to the white Rook does not mean he should also be willing to sacrifice his Rook to a Cannon. If the RxR was already good, white should have played it. Because he can legally play it, the black attacks on the white Rook are not a chase, and black is not violating any rule. That this might be unjust, because playing the RxR might somehow have bad consequences other than a direct recapture, is built into Asia rules everywhere. You only look to the legality, not to the quality of the moves. So if the white Rook is somehow tactically bound to the 4th rank, it is just white's bad luck, because black now is allowed to chase him. But it does not allow him to chase black back with other pieces.

So I see no argument at all why this should not be ruled a chase.
User avatar
phhnguyen
Posts: 1434
Joined: Wed Apr 21, 2010 4:58 am
Location: Australia
Full name: Nguyen Hong Pham

Re: A method to implement Asian rule

Post by phhnguyen »

You are right in this case.

I have been trying to find an example of attacker-specific which I have different conclusion, but not success for above example.

BTW, just OT, when I create that game in WB, it says nothing about result (*). Usually as my experience, after creating the game and then copying it into clipboard, WB will "announce" a result if it detects a loop. Is it correct or what should I do to get result from WB?


[Event "Edited game"]
[Site "PHAM"]
[Date "2010.08.18"]
[Round "-"]
[White "-"]
[Black "-"]
[Result "*"]
[Variant "xiangqi"]
[FEN "4kae2/4a4/3ce3c/p1r6/9/2R6/2P1P1P2/2C1E1C2/4A4/4KAE2 w 0 1"]
[SetUp "1"]

{--------------
. . . . k a e . .
. . . . a . . . .
. . . c e . . . c
p . r . . . . . .
. . . . . . . . .
. . R . . . . . .
. . P . P . P . .
. . C . E . C . .
. . . . A . . . .
. . . . K A E . .
white to play
--------------}
1. Rg4 Rg6 2. Rc4 Rc6 3. Rg4 Rg6 4. Rc4 Rc6 5. Rg4 Rg6 6. Rc4 Rc6 7. Rg4
Rg6
*
User avatar
hgm
Posts: 27787
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: A method to implement Asian rule

Post by hgm »

I think this is because you end with a move that is not a violation. The way it works is that when you enter a move (or an engine does one), WB tests for repeats, and determines a result according to the chasing rules if the maximum repeat count is reached (usually 3, set in the adjudications menu dialog). But if the result is a win for the side that just moved, (i.e. the opponent was violating a rule), it does not adjudicate yet, but waits until the next ply.

The idea is that apparently on the previous move the side violating the rule had not exceeded the maximum number of allowed repeats yet (you would no longer be playing if he had), and it is only the chased side that has exceeded it. So the side that is chasing has not really violated the rule yet, and should still get the opportunity to now play a different move. Only if he now persists, he will have exceeded the allowed number of repeats as well, and will be adjudicated to lose. This means WB will never adjudicate a game as a _win_ for the side that just moved. Only losses or draws. Asia rules say nothing about when exactly to adjudicate, (it is not even clear if one should adjudicate at the 3rd occurrence of a position, or the 3rd repeat (= 4th occurrence)). But this seemed the most logical solution.

In this case, when you are entering the moves of the loop, WinBoard will declare a game end due to perpetual chasing on the white moves. But, as legal moves still exist, it will still allow you to add moves to the game, which will erase any previous result. (E.g., you could want to add some moves to a game where one of the opponents resigned, or forfeited on time, or agreed draw. When the game ended because of checkmate, this is of course not possible.) So when you enter the black move, it erases the chase verdict, and because you now get into a situation where WB defers the adjudication, the result stored in the PGN when you save the game at that moment would be '*' (= unfinished).

On loading a game WB does not adjudicate; it simply reports the result stored in the PGN.
User avatar
phhnguyen
Posts: 1434
Joined: Wed Apr 21, 2010 4:58 am
Location: Australia
Full name: Nguyen Hong Pham

Re: A method to implement Asian rule

Post by phhnguyen »

Thank Muller, your explanation about WB is very clear.
User avatar
phhnguyen
Posts: 1434
Joined: Wed Apr 21, 2010 4:58 am
Location: Australia
Full name: Nguyen Hong Pham

Re: A method to implement Asian rule

Post by phhnguyen »

Hi all,

I will show you my modification of algorithm to deal with perpetual chase type of using protector (Appendix cases).

The algorithm has been still in development and not completed yet (the last Appedix example of Asian rule still fail, some real games still need to check).

However I post here:
- to help someone to has ideas how to implement Asian rule and how hard it is
- to get your valuable comments, ideas

The main modification: the attack list item is changed from pair of attacker-victim to triplet of attacker-victim-beProtected. The subtract operator is also changed to adapt the triplet. There also a
a "bug" about the moment of initializing those lists in previous post.

II. Identify chases

Attack list definition: is a list of triplets: attacker, its victim and beProtected.

All computing for attackers and victims is based on legal captures only. The boolean variable beProtected will be set true if the victim is protected by any other piece (which is same side and can attack to that victim). The computing of beProtected is tricky:
- if the victim's side is not in check, consider only protections from pieces which can capture legally the victim.
- if that side is in check, any capture (event illegal) will be considered as having a protection.

By using triplet, we can detect any change about attacker - victim - protection.


There are two main operators on that list:
- Subtract(list1, list2): remove from list 1 all items which are also in the list 2. This function is used to remove all static attacks which have the same attacker-victim-beProtected.
- Interception (list1, list2): In the list 1, keep only items which their victims are also in the list 2. This function is used to keep track only victims which are continuously being attacked after moves.

I have been using C++ so for short I can define and use two operators by notations - and &

We use an attack list array attackList[side][nmove] to calculate and store all attacks for both sides for each position.

We also use other attack list array chaseList[2] to calculate the chase for both sides.

1) Initializing chaseList

Suppose we start from a position which is the first one of the repeat and moveSide is the side will to make the first move. The chase list of the opponent side to move will be computed for that position. However, the chase list of the moving side will be computed after that move (it means at the second position)

Code: Select all

chaseList[otherSide] = attackList[otherSide][0];
chaseList[moveSide] = attackList[moveSide][1];
We have to update both chase lists after each move.

Suppose chaseList[side] is the chase list for a given side and we are in the position nth

2) If the latest move is from opponent side

Code: Select all

chaseList[side] = chaseList[side] - attackList[side][n];
3) If the lattest move is from the given side

Code: Select all

chaseList[side] = (attackList[side][n] - attackList[side][n-1]) & chaseList[side];

Some notes:
- Adding new variable beProtected make our algorithm more expensive.
- I still have trouble with protection pattern "Cannon of victim side - Mount - Attacker - Victim". If we count Cannon as a protector, some examples of Asian rule will not passed. If no, the last appendix example (3) will be fail.

/Pham
User avatar
phhnguyen
Posts: 1434
Joined: Wed Apr 21, 2010 4:58 am
Location: Australia
Full name: Nguyen Hong Pham

Re: A method to implement Asian rule

Post by phhnguyen »

I will give you an illustation of how the algorithm works. In almost all cases of Asian rule examples, victims usually have not any protectors so the algorithm works as the old version (before adding the boolean
variable beProtected). The previous illustration which I have posted on 08/08/2010 (in this topic) still valid.

Bellow the first game of Asian rule appendix:

[Event "Asia Rules Appendix 1"]
[Site "PHAMHN"]
[Date "2010.08.09"]
[Round "-"]
[White "-"]
[Black "-"]
[Result "0-1"]
[Variant "xiangqi"]
[FEN "2ca1k3/4a4/e3e4/2P5P/6p2/1C7/9/E7H/2hR5/2EAK4 w 0 1"]
[SetUp "1"]

Code: Select all

{--------------
. . c a . k . . .
. . . . a . . . .
e . . . e . . . .
. . P . . . . . P
. . . . . . p . .
. C . . . . . . .
. . . . . . . . .
E . . . . . . . H
. . h R . . . . .
. . E A K . . . .
white to play
--------------}
1. cd6 Ec5 2. dc6 Ea7 3. cd6 Ec5 4. dc6 Ea7
{Red keeps moving its Pawn to keep the Black Knight "unprotected".
This constitutes the Red Rook perpetually chasing the unprotected
Black Knight. Red is violating the rule.}
0-1

To denote triplet of attacker-viction-beProtected I will use notation => for the attack from attacker to victim and * if the victim is protected.

1) Initializing chase lists
The side to move is White. We will initialize the chase list of Black side based on the first position. The one for White will be computed base on the next position

chaseList[ B ] = attackList[ B ][0] = { h=>E1* }

Black Horse is attacking the White Elephant in the left border (E1). It is protected by other Elephant (E2) in the column c.

2) After move 1. cd6
attackList[ W ][1] = { R=>h }
attackList[ B ][1] = { h=>E1*, c=>E2* }

chaseList[ B ] = chaseList[ B ] - attackList[ B ][1] = { h=>E1* } - { h=>E1*, c=>E2* } = { } // empty

We initialize for chaseList[ W ] here:

chaseList[W] = attackList[ W ][1] = { R=>h }

3) After move 1. ... Ec5
attackList[W][2] = { R=>h* }

chaseList[W] = chaseList[ W ] - attackList[ W ][1] = { R=>h } - { R=>h* } = { R=>h }

Notes:
- attackers and victims of White from previous and this position are the same but beProtected is changed, allow us to keep the new attack
- becase chaseList[ B ] is empty, we can stop computing it and attackList[ B ];

4) After move 2. dc6
attackList[ W ][3] = { R=>h }

chaseList[ W ] = (attackList[W][3] - attackList[W][2]) & chaseList[W] = ({ R=>h } - { R=>h* } ) & { R=>h } = { R=>h } & { R=>h } = { R=>h }

After move 2. ... Ea7
attackList[W][4] = { R=>h* }

chaseList[W] = chaseList[ W ] - attackList[ W ][4] = { R=>h } - { R=>h* } = { R=>h }


Until here we finish a full repeat. chaseList[W] is not empty. White is using Rook to chase Black Horse.

/Pham