🕸📝Fergus Duniho wrote on Mon, Apr 6, 2020 09:25 PM UTC:
While the simplest way of writing your Apothecary_King function will use flagged spaces, this should work using the method you're using now:
def Apothecary_King
checkleap #0 #1 1 3
or checkleap #0 #1 1 2
and match rankname #1 1 10
and or var K1stmove == #0 f2 or var k1stmove == #0 f9
or checkleap #0 #1 1 0
or checkleap #0 #1 1 1;
Although the piece being moved will be found on a different space for actual moves and potential moves, the location of the original space remains the same whether the move is actual or potential. So, if the King is moving from its original space, and its 1st move variable is set, then it is on it's first move. Since the available Knight and Camel moves only allow the King to go to the back rank, this function also checks whether the move is to the back rank. This allows it to use checkleap instead of checkaleap, and that avoids the need to test which King is moving on each line.
While the simplest way of writing your Apothecary_King function will use flagged spaces, this should work using the method you're using now:
Although the piece being moved will be found on a different space for actual moves and potential moves, the location of the original space remains the same whether the move is actual or potential. So, if the King is moving from its original space, and its 1st move variable is set, then it is on it's first move. Since the available Knight and Camel moves only allow the King to go to the back rank, this function also checks whether the move is to the back rank. This allows it to use checkleap instead of checkaleap, and that avoids the need to test which King is moving on each line.