The Chess Variant Pages
Custom Search



Enter Your Reply

The Comment You're Replying To
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.


Edit Form

Comment on the page Chess page

Quick Markdown Guide

By default, new comments may be entered as Markdown, simple markup syntax designed to be readable and not look like markup. Comments stored as Markdown will be converted to HTML by Parsedown before displaying them. This follows the Github Flavored Markdown Spec with support for Markdown Extra. For a good overview of Markdown in general, check out the Markdown Guide. Here is a quick comparison of some commonly used Markdown with the rendered result:

Top level header: <H1>

Block quote

Second paragraph in block quote

First Paragraph of response. Italics, bold, and bold italics.

Second Paragraph after blank line. Here is some HTML code mixed in with the Markdown, and here is the same <U>HTML code</U> enclosed by backticks.

Secondary Header: <H2>

  • Unordered list item
  • Second unordered list item
  • New unordered list
    • Nested list item

Third Level header <H3>

  1. An ordered list item.
  2. A second ordered list item with the same number.
  3. A third ordered list item.

Alt text for a graphic image

A definition list
A list of terms, each with one or more definitions following it.
An HTML construct using the tags <DL>, <DT> and <DD>.
A term
Its definition after a colon.
A second definition.
A third definition.
Another term following a blank line
The definition of that term.