Check out Makruk (Thai Chess), our featured variant for March, 2025.


[ 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]
💡📝H. G. Muller wrote on Thu, Oct 27, 2022 10:58 AM EDT in reply to Carlos Cetina from 05:43 AM:

Carlos Cetina wrote on 2022-10-27 UTC

@HG

Trying to enforce the rules to the Cetina Random Chess preset through the Play-Test Applet I get this warning:

Syntax Error on line 279

Missing both default and case "#rng" in switch

I don't know what that means nor how to fix it. Could you please take a look at it? 

Well, the switch statement against which it complains should only be executed when #rng (the range of a move) is negative. The if statement around that should guarantee that. The legdefs array from which this range is taken does not contain any negative range.

So I suspect this is a case of misalignment, where the start value used in the array for the moves of a piece is 'out of register', so that numbers that represent board-step coordinates are interpreted as a range. I suspect it has to do with these lines for the Bishop Conversion:

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

These functions B and b are supposed to return the number of the starting element of the list of moves for the B and b piece in the legdefs array. I suppose they somehow return an incorrect number. Does the error disappear when you remove those lines, or just let the functions B and b return 0 always?

[Edit] 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.