Check out Modern Chess, our featured variant for January, 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

Game Courier Developer's Guide. Learn how to design and program Chess variants for Game Courier.[All Comments] [Add Comment or Rating]
🕸📝Fergus Duniho wrote on Sun, Nov 5, 2023 03:55 PM UTC in reply to A. M. DeWitt from 02:32 PM:

Here is the function that is probably at fault:

def Black_Heavenly_Horse-Range merge leaps #0 1 1 array where #0 -2 -2 where #0 0 -2 where #0 2 -2 where #0 -1 2 where #0 1 2 where #0 0 -1;

Since your Black Heavenly Horse is on the side of the board, some of the where clauses will return false, but the array of coordinates to check for legal moves on should not contain any false values. To weed out the false values, you should build your array with a lambda function, probably using aggregate. So this code may work:

def Black_Heavenly_Horse-Range merge leaps #frm 1 1 aggregate lambda (where #frm #0 #1) array ((-2 -2) (0 -2) (2 -2) (-1 2) (1 2) (0 -1)) =frm;

I'll leave it to you to test it.

This might also work. It feeds your original array into aggregate to weed out any empty values. Within parentheses, #0 should just be the value of each element passed to the lambda function, not the first argument passed to the function. If it doesn't work that way, you can replace the outer #0 with a named variable, as I did above.

def Black_Heavenly_Horse-Range aggregate lambda (#0) merge leaps #0 1 1 array where #0 -2 -2 where #0 0 -2 where #0 2 -2 where #0 -1 2 where #0 1 2 where #0 0 -1;