03-03-2022, 08:54 AM
Ok. Let's start over. I have come to believe that the only correct way of doing this is by using (then). What I want to do is to update both players' kings at the end of each player's turn. An entire turn looks like this:
And the most relevant part (as far as I can see) is this:
This should first go through all stacks of Mover and update which one is king if there is a unique biggest stack, then it should do the same for Next. The actual result seems to be that it simply does not perform the second iteration (over stacks belonging to Next).
I have attached a trial. On move 17, white captures a black 3-stack which makes it the case that the other 3-stack is uniquely tall among the black stacks. Yet, that stack is not made king. Not until after Black has made a move, that is. How come? What am I missing here?
Code:
(forEach Piece
("Move")
Mover
top:True
(then
(do
(remove (sites Outer) count:(size Stack at:(last To)))
next:("UpdateKing" Mover
(then ("UpdateKing" Next))
)
)
)
)
Code:
("UpdateKing" Mover
(then ("UpdateKing" Next))
)
This should first go through all stacks of Mover and update which one is king if there is a unique biggest stack, then it should do the same for Next. The actual result seems to be that it simply does not perform the second iteration (over stacks belonging to Next).
I have attached a trial. On move 17, white captures a black 3-stack which makes it the case that the other 3-stack is uniquely tall among the black stacks. Yet, that stack is not made king. Not until after Black has made a move, that is. How come? What am I missing here?