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:
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;
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;