Check out Grant Acedrex, our featured variant for April, 2024.

Enter Your Reply

The Comment You're Replying To
🕸Fergus Duniho wrote on Sun, Oct 16, 2022 05:11 PM UTC in reply to A. M. DeWitt from 01:29 AM:

Here are your definitions for fd and FD:

def fd cond var firstpart (checkride #0 #1 1 1 or checkaride #0 #1 -1 0 or checkaride #0 #1 1 0 or checkmaxsteps #0 #1 3) (sub FD #0 #1 and cond empty #0 (not match old FD +WB +CS) (not match space #1 FD +WB +CS)) and #0 and #1;
def FD cond var firstpart (checkride #0 #1 1 1 or checkaride #0 #1 -1 0 or checkaride #0 #1 1 0 or checkmaxsteps #0 #1 3) (sub FD #0 #1 and cond empty #0 (not match old fd +wb +cs) (not match space #1 fd +wb +cs)) and #0 and #1;

Let me format these to show the logic better:

def fd 
cond var firstpart 
  (checkride #0 #1 1 1 or checkaride #0 #1 -1 0 or checkaride #0 #1 1 0 or checkmaxsteps #0 #1 3) 
  (sub FD #0 #1 
  and cond empty #0 
    (not match old FD +WB +CS) 
    (not match space #1 FD +WB +CS)
  ) 
and #0 
and #1;

def FD 
cond var firstpart 
  (checkride #0 #1 1 1 or checkaride #0 #1 -1 0 or checkaride #0 #1 1 0 or checkmaxsteps #0 #1 3)
  (sub FD #0 #1 
  and cond empty #0 
    (not match old fd +wb +cs) 
    (not match space #1 fd +wb +cs)
  ) 
and #0 
and #1;

These first make sure that #0 and #1 are included in the function so that you can use them in parenthesized expressions. It then skips over the parenthesized expressions and goes to the variable firstpart. If its value is non-empty, it executes (checkride #0 #1 1 1 or checkaride #0 #1 -1 0 or checkaride #0 #1 1 0 or checkmaxsteps #0 #1 3), and it is empty, it executes

  (sub FD #0 #1 
  and cond empty #0 
    (not match old fd +wb +cs) 
    (not match space #1 fd +wb +cs)
  ) 

First, it checks whether #0 is empty. If it is, it executes (not match old fd +wb +cs), and it it isn't, it executes (not match space #1 fd +wb +cs). Each returns a truth value. If the truth value is true, then it will allow the execution of the subroutine FD. That subroutine looks like this:

sub FD from to;
  return cond cond empty #from capture (not empty #to) (checkleap #from #to 0 1 or checkleap #from #to 1 1) (checkleap #from #to 0 1 or checkleap #from #to 1 1 and == var ori #to) and #to;
endsub;

For some reason, this subroutine just returns a function call without making use of the imperative programming available to subroutines.

Reformatting it to show its logic, it looks like this:

sub FD from to;
  return cond 
    cond empty #from 
      capture 
      (not empty #to) 
  (checkleap #from #to 0 1 
    or checkleap #from #to 1 1) 
  (checkleap #from #to 0 1 
    or checkleap #from #to 1 1 
    and == var ori #to) 
and #to;
endsub;

If a player hasn't moved yet, #from will be occupied, and if he has moved, #from will be empty. If he has moved, the inner cond returns the value of capture, and if he hasn't, it returns true if the move would result in a capture. This value is passed to the outer cond. If it's a capturing move, it can move one space in any direction. If it's not a capturing move, its move is allowed only if the value of ori is the same as to. It looks like #ori has been set to the origin. So, this might stop it from making non-capturing moves.


Edit Form

Comment on the page Game Courier Developer's Guide

Conduct Guidelines
This is a Chess variants website, not a general forum.
Please limit your comments to Chess variants or the operation of this site.
Keep this website a safe space for Chess variant hobbyists of all stripes.
Because we want people to feel comfortable here no matter what their political or religious beliefs might be, we ask you to avoid discussing politics, religion, or other controversial subjects here. No matter how passionately you feel about any of these subjects, just take it someplace else.
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.
Here is some preformatted text.
  This line begins with some indentation.
    This begins with even more indentation.
And this line has no indentation.

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.