Haha. I found some time to tweak your code, but I was in such a hurry I posted it to the wrong thread. Here is a link (I’m not at my computer, so I can’t re-upload). I might have time to explain some og the changes later.
Edit: I have attached a cleaner version.
It's nagging me that (move Remove) doesn't have a <from> parameter. And it should have had either a "count:" parameter or a "stack:"-parameter so one could remove more than one piece. If it did, the code would have been very elegant (after phase 1, which is lacking here also): (move Remove (from "PlayableSites") stack:true (then (add …))) But I had to use (move Select) and (remove).
The good news is that the "count:"-parameter on (add) works when you do it this way. The bad news is that (remove) also lacks a "count:" or "stack:"-parameter. I have tried to simulate removing a stack with (move (from "PlayableSites") (to Off) stack:true (then (add …))) but it is either not possible to move to Off (-1) or it is not possible to move from an empty site. I also can't find a way to iterate over the pieces in a stack, to remove them "one by one" so to speak.
Edit: I have attached a cleaner version.
It's nagging me that (move Remove) doesn't have a <from> parameter. And it should have had either a "count:" parameter or a "stack:"-parameter so one could remove more than one piece. If it did, the code would have been very elegant (after phase 1, which is lacking here also): (move Remove (from "PlayableSites") stack:true (then (add …))) But I had to use (move Select) and (remove).
The good news is that the "count:"-parameter on (add) works when you do it this way. The bad news is that (remove) also lacks a "count:" or "stack:"-parameter. I have tried to simulate removing a stack with (move (from "PlayableSites") (to Off) stack:true (then (add …))) but it is either not possible to move to Off (-1) or it is not possible to move from an empty site. I also can't find a way to iterate over the pieces in a stack, to remove them "one by one" so to speak.