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

Enter Your Reply

The Comment You're Replying To
🕸Fergus Duniho wrote on Thu, Jun 1, 2017 11:26 AM UTC:

The Alfaerie: Many set is one I have never used and do not recommend the use of. Consequently, I have never tried to program around its limitations. I recommend creating your own set, but if you don't want to do that, then you might try using one of the automatic sets, which name pieces after file names.

It has occured to me since writing this that you could name your functions after aliases instead of the actual piece labels and be sure to use the aliases and not the actual labels when calling the functions.

def G checkride #0 #1 1 0 or checkleap #0 #1 1 1;
def GL merge rays #0 1 0 leaps #0 1 1;

I understand that the #0 and #1 stand for the initial square moved and final square moved, but I don't understand how the 1's and 0's after those work exactly, though I have been able to fudge the results I want with those.

The other ones and zeros are actual ones and zeros, not variables. They are arguments to the function. Your definition of G checks whether the piece moves as a Dragon King. "checkleap #0 #1 1 1" checks whether a piece can make a one-space diagonal move. This can also be done by calling checkaleap up to four times, like so:

checkaleap #0 #1 1 1 or checkaleap #0 #1 1 -1 or checkaleap #0 #1 -1 1 or checkaleap #0 #1 -1 -1

In checkaleap, the first number is how many files a piece moves in its leap, and the second number is how many ranks. In checkleap, the order and signs of the numbers do not matter. Instead, the two values are used in whichever order and whichever positive or negatives values are most applicable to the actual move. This allows the values of 1 and 1 to describe any one-space diagonal move.

For the leaps function, the order of the numbers and their signs also do not matter. From a single pair of values, all possible combinations of orders and negative or positive values are calculated. Up to eight combinations are possible. For example, "leaps #0 1 2" would return up to eight legal moves for a Knight. But when the values are the same, or when one is zero, this cuts the number in half.

"checkride #0 #1 1 0" checks whether it moves as a Rook, which makes a riding move through a series of steps in a direction that moves one space at a time along a single rank or file. The same thing could be checked with four checkaride functions, like so:

checkaride #0 #1 1 0 or checkaride #0 #1 -1 0 or checkaride #0 #1 0 1 or checkaride #0 #1 0 -1

In checkaride, the first number is how many files the piece moves on each leap, and the second is how many ranks it moves on each leap. In checkride, the order of the numbers do not matter, and their signs do not matter. It will use them in whichever order and arrangement of negative and positives values best fits the actual move. This allows "1 0" or "0 1" to be used to describe movement along a single dimension of the board.

For the rays function, the order of the numbers and their signs also do not matter. From a single pair of values, all possible combinations of orders and negative or positive values are calculated.


Edit Form
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.