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


[ 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

Play-test applet for chess variants. Applet you can play your own variant against.[All Comments] [Add Comment or Rating]
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).