I'm trying to follow these instructions to enforce the rules for this game, but I've run into trouble with my pawn subroutine. I want the pawns to capture by jumping over one piece to an empty space, but the hopping move isn't accepted as legal.
sub P from to;
verify > rank #to rank #from;
if capture:
die "A Pawn may only capture by jumping over a piece immediately in front of itself.";
elseif == distance #from #to 2:
verify checkahop #from #to -1 1 or checkahop #from #to 0 1 and islower screen;
capture screen;
else:
verify checkaride #from #to -1 1 or checkaride #from #to 0 1;
endif;
if onboard where #to 0 #pzs or onboard where #to -1 #pzs:
if != space #to moved:
die "You may not promote a Pawn until it reaches the promotion zone.";
endif;
elseif == P space #to:
askpromote #wprom;
elseif not match space #to var wprom:
set np space #to;
die "You may not promote your Pawn to a" #np;
endif;
set nopvc 0;
return true;
endsub;
I'm trying to follow these instructions to enforce the rules for this game, but I've run into trouble with my pawn subroutine. I want the pawns to capture by jumping over one piece to an empty space, but the hopping move isn't accepted as legal.