🕸Fergus Duniho wrote on Thu, May 28, 2020 11:18 PM UTC:
One of the things that can make programming double moves more difficult is the loss of information about the previous move. To help correct that, I have added three new variables called $prevmoved, $prevorigin and $prevdest. These store the previous values of $moved, $origin and $dest respectively. Using these, you could detect whether a Joker has been dropped and test whether the previous move was legal. Here's how it could work.
Instead of using $moved, $origin and $dest in the code for evaluating the main move, use some variables, such as #piece, #from and #to. If the last move was a Joker drop, set these variables to $prevmoved, $prevorigin, and $prevdest. Otherwise, set them to $moved, $origin, and $dest. Evaluate the move. Then if a Joker drop was made, evaluate that.
One of the things that can make programming double moves more difficult is the loss of information about the previous move. To help correct that, I have added three new variables called $prevmoved, $prevorigin and $prevdest. These store the previous values of $moved, $origin and $dest respectively. Using these, you could detect whether a Joker has been dropped and test whether the previous move was legal. Here's how it could work.
Instead of using $moved, $origin and $dest in the code for evaluating the main move, use some variables, such as #piece, #from and #to. If the last move was a Joker drop, set these variables to $prevmoved, $prevorigin, and $prevdest. Otherwise, set them to $moved, $origin, and $dest. Evaluate the move. Then if a Joker drop was made, evaluate that.