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

Enter Your Reply

The Comment You're Replying To
Carlos Cetina wrote on Thu, Oct 27, 2022 03:49 PM UTC:

It seems you have removed the lines, and the error has now disappeared. What are BBB, WWW and BWBWBW supposed to be anyway? They did not seem to be defined anywhere; their only occurrence was in those two functions.

 

I copied and pasted those lines from the following paragraph taken from A Wizard for Game-Code Generation:

Another example where this technique can be useful is the Bishop Conversion Rule. This rule specifies Bishops can move on their initial move as either a Bishop or Wazir, but the two Bishops cannot start in the same way. One way to implement that is by having separate definitions of a Bishop, a Wazir and their compound in the legdefs table, and let the Bishop function dynamically decide for virgin Bishops which of the definitions to use. You would need an extra variable for each player to remember whether one of the possibilities has already been used up by the other Bishop, and if so, which one. If nothing has been done yet, a virgin Bishop moves like the compound. But if a Wazir move was done, it should move like a Bishop, and vice versa. Non-virgin Bishops would always move like a Bishop.

// in the Pre-Game section:
set many wstart 0 bstart 0; // indicate no Bishop has moved yet
// in the Post-Move sections, after the gosub HandleMove
if == B #mover and not flag #ori:                // a virgin Bishop moved
set wstart cond checkleap #ori #desti 0 1 1 2; // 1 = as Wazir, 2 = as Bishop
endif;

That is for the Post-Move 1 section (white moves); in Post-Move 2 you would use b and bstart instead of B and wstart. The 'flag' on a square tells you whether the piece on there has moved before, moverori and desti are the label for the piece that moved, the origin square and the destination square, respectively, all left by HandleMove. You can then change functions B and b in the Pre-Game code to

def B cond #0 (cond flag var ori BBB cond == 1 var wstart BBB cond var wstart WWW BWBWBW) 0;

and a similar function for black, where BBBWWW and BWBWBW are the index of the Bishop, Wazir and BW compound moves in legdefs. The expression between parentheses would return BBB when the flag on the square of origin was set (meaning this Bishop had moved before, so that it should keep moving as a Bishop), or when wstart=1 (meaning the other Bishop has already started as a Wazir). Otherwise, when wstart=0 it returns the index for the moves of the compound (as this then is the first Bishop we move in this game), and if none of that is the case, it moves like a Wazir (as the other Bishop must have started as a Bishop, wstart=2).

 

 

 


Edit Form

Comment on the page Play-test applet for chess variants

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.