🕸📝Fergus Duniho wrote on Tue, Mar 10, 2020 06:30 PM UTC:
I was recently thinking about how to do a Chameleon piece with the new fairychess include file, though I haven't done anything yet. Here's what could work. Use a global variable to keep track of the last piece moved by the previous player. For example, put "set lastpiece $moved;" at the end of the Post-Move sections. Then define the piece like so:
def Joker fn const alias #lastpiece #0 #1;
def Joker-Range fn join const alias #lastpiece "-Range" #0;
If you're not using aliases for any pieces, you can omit the "alias" keyword. For earlier include files, the principle would be the same, but the code would be different.
I was recently thinking about how to do a Chameleon piece with the new fairychess include file, though I haven't done anything yet. Here's what could work. Use a global variable to keep track of the last piece moved by the previous player. For example, put "set lastpiece $moved;" at the end of the Post-Move sections. Then define the piece like so: