08-14-2020, 10:37 AM
I wanted to try implementing The Duke, where the pieces are tiles that flip over after moving, and move differently depending on which side is up.
I've set up the pieces with (flips 1 2) to toggle between the two states, and after moving I apply the (flip (last To)) move but it has no effect. Explicitly checking and setting the piece state works though.
This does NOT work:
(forEach Piece (then (flip (last To))))
This does work:
(forEach Piece (then
(if (= 1 (state at:(last To)))
(set State (last To) 2)
(set State (last To) 1)
)
))
I've set up the pieces with (flips 1 2) to toggle between the two states, and after moving I apply the (flip (last To)) move but it has no effect. Explicitly checking and setting the piece state works though.
This does NOT work:
(forEach Piece (then (flip (last To))))
This does work:
(forEach Piece (then
(if (= 1 (state at:(last To)))
(set State (last To) 2)
(set State (last To) 1)
)
))