12-14-2020, 09:00 AM
Hi,
For all the variables used inside a move description (site), (to), (from), (between), etc.... They are possible to be used inside the ludeme setting them, like here with the (forEach Site ...)
However when you call a (then ...) you create a consequence of that move. If you look the Ludii Game Logic Guide: "The Then object corresponds to the consequences of each legal move. This object contains its own Moves object evaluated and applied after applying the move decided by the mover."
Consequently, the moves inside the (then ...) are computed after one move is decided by the mover (so applied) and use that state as a reference to be computed. That's why you need use (last To) and (last From) and not any variable set during the computation of the moves in the ludeme. These variables at that moment are already set again to their default value.
So to sum up, when the (then ...) ludeme is used, the moves inside it are not computed in the same time at any other computation in the ludeme. So all the variables used in the first computation are not possible to be used as a reference and you need to use the variables to refer to the temporary state after applying the move decided.
Regards,
Eric
For all the variables used inside a move description (site), (to), (from), (between), etc.... They are possible to be used inside the ludeme setting them, like here with the (forEach Site ...)
However when you call a (then ...) you create a consequence of that move. If you look the Ludii Game Logic Guide: "The Then object corresponds to the consequences of each legal move. This object contains its own Moves object evaluated and applied after applying the move decided by the mover."
Consequently, the moves inside the (then ...) are computed after one move is decided by the mover (so applied) and use that state as a reference to be computed. That's why you need use (last To) and (last From) and not any variable set during the computation of the moves in the ludeme. These variables at that moment are already set again to their default value.
So to sum up, when the (then ...) ludeme is used, the moves inside it are not computed in the same time at any other computation in the ludeme. So all the variables used in the first computation are not possible to be used as a reference and you need to use the variables to refer to the temporary state after applying the move decided.
Regards,
Eric