The Chess Variant Pages
Custom Search




[ Help | Earliest Comments | Latest Comments ]
[ List All Subjects of Discussion | Create New Subject of Discussion ]
[ List Earliest Comments Only For Pages | Games | Rated Pages | Rated Games | Subjects of Discussion ]

Single Comment

This item is a play-by-email page
It belongs to categories: Orthodox chess, 
It was last modified on: 2016-12-11
 Author: Fergus  Duniho. Chess. Play Chess online with other people, using Game Courier, a PBM system that works with any web browser on any computer.[All Comments] [Add Comment or Rating]
Fergus Duniho wrote on 2015-11-21 UTC

I seem to have gotten it to work now. I changed

def P 
remove #ep
checkleap #0 #1 1 1
and == var ep join filename #1 rankname #0
or and checkatwostep #0 #1 0 1 0 1 == rankname #0 #wpr 
or checkleap #0 #1 0 1 
and empty #1 
or and islower space #1 checkleap #0 #1 1 1
and > rank #1 rank #0;

to this

def P 
remove var ep
and checkleap #0 #1 1 1
and == var ep join filename #1 rankname #0
or and checkatwostep #0 #1 0 1 0 1 == rankname #0 #wpr 
or checkleap #0 #1 0 1 
and empty #1 
or and islower space #1 checkleap #0 #1 1 1
and > rank #1 rank #0;

Remember that Game Courier reads all of this backwards, and this is just one of two Pawn functions. The first change I made was to the logic of the function. I put an and in front of the second to last operation, checkleap #0 #1 1 1, so that nothing would be left on the stack when it got to the last operation. Since it still didn't work, I changed #ep to var ep. That worked. Now, why would I need var ep but get away with using #wpr. The difference is that wpr is effectively a constant, keeping the same value throughout execution of the program. So, when I define the function, wpr already has the value I will need it to have whenever I use the function. But ep is a true variable whose value keeps changing. To make sure the function uses its current value, I need to use var ep instead of #ep.

The remove built-in function is a new one for removing a piece from a space. It exits automatically with the value of an assignment to '@'. Most built-in functions do not change anything, focusing instead on returning values. But I wanted to check possible Pawn moves with a function alone instead of using a subroutine.