12-07-2020, 08:15 AM
Hi,
When you reach such a problem and you are not sure of the source, according to me the process is to comment many parts of the description while the wrong move/illegal move/bug is still there in order to identify the cause.
In looking your game and example, I found something weird in the description which is probably the cause.
The movement of the full stack you show as illegal comes from that:
That means for each piece of the mover at the top of a stack the corresponding moves of "MoveStackPart" are legals in setting the (from) variable for each site where these stacks are.
Until now, no problem.
BUT
The define "MoveStackPart" is a (forEach Value .... (move (from ...) (to ...)) ....)
AND the data in the (from ...) are ALL the sites occupied by the mover with a stack of at least size 2.
Consequently, that means
For each piece at the top of the stack owned by the mover, you look ALL the sites owned by the mover with a stack of size bigger than 2 and makes legal moves from them.
Consequently the illegal move you found comes from that, because in your trial you have some stacks of size 3 with the top piece owned by the mover and these stacks make possible to move any stack of size 2 owned by the mover (so the full stack can be moved here).
To remove that illegal move just modify the content of (from ...) in this define by just (from) and the illegal move will disappear.
I am not sure that your game will be exactly like you want, but at least now you know the cause and how to fix that.
Regards,
Eric
When you reach such a problem and you are not sure of the source, according to me the process is to comment many parts of the description while the wrong move/illegal move/bug is still there in order to identify the cause.
In looking your game and example, I found something weird in the description which is probably the cause.
The movement of the full stack you show as illegal comes from that:
Code:
(forEach Piece
("MoveStackPart")
Mover
top:true
)
That means for each piece of the mover at the top of a stack the corresponding moves of "MoveStackPart" are legals in setting the (from) variable for each site where these stacks are.
Until now, no problem.
BUT
The define "MoveStackPart" is a (forEach Value .... (move (from ...) (to ...)) ....)
AND the data in the (from ...) are ALL the sites occupied by the mover with a stack of at least size 2.
Consequently, that means
For each piece at the top of the stack owned by the mover, you look ALL the sites owned by the mover with a stack of size bigger than 2 and makes legal moves from them.
Consequently the illegal move you found comes from that, because in your trial you have some stacks of size 3 with the top piece owned by the mover and these stacks make possible to move any stack of size 2 owned by the mover (so the full stack can be moved here).
To remove that illegal move just modify the content of (from ...) in this define by just (from) and the illegal move will disappear.
I am not sure that your game will be exactly like you want, but at least now you know the cause and how to fix that.
Regards,
Eric