08-11-2020, 05:28 AM
(This post was last modified: 08-11-2020, 05:31 AM by Eric Piette.)
Hi,
If I understand correctly, you want to avoid the same player to go back to the previous position of the last piece moved.
Many ways are possible to describe that, but here you can find one using the same mechanism (with the do ludeme) of your example:
And just for information, I include the (moveAgain) ludeme in this example but maybe you already did it in one in the generator of the move of the pieces.
Moreover, the pending values are values stored only during one state, then they are reset. They are the variables to use for a such case in order to implement it efficiently.
Regards,
Eric Piette
If I understand correctly, you want to avoid the same player to go back to the previous position of the last piece moved.
Many ways are possible to describe that, but here you can find one using the same mechanism (with the do ludeme) of your example:
Code:
(do
(forEach Piece)
ifAfterwards:(not
(and
(is In (last To) (sites Pending))
(is In (last From) (sites Pending))
)
)
(then
(and
(set Pending (sites {(last To) (last From)}))
(moveAgain)
)
)
)
And just for information, I include the (moveAgain) ludeme in this example but maybe you already did it in one in the generator of the move of the pieces.
Moreover, the pending values are values stored only during one state, then they are reset. They are the variables to use for a such case in order to implement it efficiently.
Regards,
Eric Piette