08-10-2020, 10:19 AM
The reference has a rules for (var "string") that seems to allow back multiple state variables. How do I set the values? (set Var ...) does not take a name, it only sets the anonymous (var) value and I find myself in need of more than one variable.
My actual problem is implementing a 'don't undo the last move' rule. The (meta (noRepeat Positional)) does not seem to have an effect, and (avoidStoredState ... (then (rememberState))) also does not work as I want.
I've got this almost working, but need more than one variable to hold the (last From) state as well.
(do
(forEach Piece)
ifAfterwards:(not (= (var) (last To)))
(then (set Var (last From)))
)
Would really like to do this:
(do
(forEach Piece)
ifAfterwards:(not (and (= (var "LastFrom") (last To)) (= (var "LastTo") (last From))))
(then (and (set Var "LastFrom" (last From)) (set Var "LastTo" (last To))))
)
PS. Can you disable smilies by default in this subforum too?
My actual problem is implementing a 'don't undo the last move' rule. The (meta (noRepeat Positional)) does not seem to have an effect, and (avoidStoredState ... (then (rememberState))) also does not work as I want.
I've got this almost working, but need more than one variable to hold the (last From) state as well.
(do
(forEach Piece)
ifAfterwards:(not (= (var) (last To)))
(then (set Var (last From)))
)
Would really like to do this:
(do
(forEach Piece)
ifAfterwards:(not (and (= (var "LastFrom") (last To)) (= (var "LastTo") (last From))))
(then (and (set Var "LastFrom" (last From)) (set Var "LastTo" (last To))))
)
PS. Can you disable smilies by default in this subforum too?