The problem with using $prev is that it doesn't seem to offer any hope of expanding the capabilities to more than 1 move + 1 explicit side effect, something I would still like to do in the future.
I'm thinking of providing more information, but it requires an array, and I'm still looking into how I might handle that.
the store and restore this requires to not mess up the game state must also be an order of magnitude more expensive than just testing pseudo-legality of a given move.
It's not that expensive. It is just copying variables. But it is not needed. There is a checkbox in the Edit menu called "Do Not Include Moves in Code". Check this if you want to handle moves on your own without having them performed automatically. I just did this for Extra Move Chess, and I got rid of the store and restore lines.
Is there a variable that holds the current game length? ... is this a matter of comparing movenum with mln ?
It is a matter of comparing mln with $maxmln. When they are equal, it is the latest move.
I'm thinking of providing more information, but it requires an array, and I'm still looking into how I might handle that.
It's not that expensive. It is just copying variables. But it is not needed. There is a checkbox in the Edit menu called "Do Not Include Moves in Code". Check this if you want to handle moves on your own without having them performed automatically. I just did this for Extra Move Chess, and I got rid of the store and restore lines.
It is a matter of comparing mln with $maxmln. When they are equal, it is the latest move.