I have now fixed the problem. In each function I replaced the line and checkleap #0 #1 0 1 var ep #1 with two lines that more exactly checked that the destination space was directly behind the Pawn that had made a double move. Here is the old code:
def P
remove var ep
and or checkaleap #0 #1 1 1 checkaleap #0 #1 -1 2
and checkleap #0 #1 0 1 var ep #1
and var ep
or and checkatwostep #0 #1 0 1 0 1 and flag #0 < rank #0 6
or checkleap #0 #1 0 1
and empty #1
or and islower space #1 checkaleap #0 #1 1 1
or and islower space #1 checkaleap #0 #1 -1 2
and > rank #1 rank #0;
def p
remove var ep
and or checkaleap #0 #1 1 -2 checkaleap #0 #1 -1 -1
and checkleap #0 #1 0 -1 var ep #1
and var ep
or and checkatwostep #0 #1 0 -1 0 -1 and flag #0 > rank #0 6
or checkleap #0 #1 0 -1
and empty #1
or and isupper space #1 checkaleap #0 #1 1 -2
or and isupper space #1 checkaleap #0 #1 -1 -1
and < rank #1 rank #0;
I changed it to this, and it worked:
def P
remove var ep
and or checkaleap #0 #1 1 1 checkaleap #0 #1 -1 2
and == + 1 rankname var ep rankname #1
and == filename var ep filename #1
and var ep
or and checkatwostep #0 #1 0 1 0 1 and flag #0 < rank #0 6
or checkleap #0 #1 0 1
and empty #1
or and islower space #1 checkaleap #0 #1 1 1
or and islower space #1 checkaleap #0 #1 -1 2
and > rank #1 rank #0;
def p
remove var ep
and or checkaleap #0 #1 1 -2 checkaleap #0 #1 -1 -1
and == - 1 rankname var ep rankname #1
and == filename var ep filename #1
and var ep
or and checkatwostep #0 #1 0 -1 0 -1 and flag #0 > rank #0 6
or checkleap #0 #1 0 -1
and empty #1
or and isupper space #1 checkaleap #0 #1 1 -2
or and isupper space #1 checkaleap #0 #1 -1 -1
and < rank #1 rank #0;
I have now fixed the problem. In each function I replaced the line
and checkleap #0 #1 0 1 var ep #1
with two lines that more exactly checked that the destination space was directly behind the Pawn that had made a double move. Here is the old code:I changed it to this, and it worked: