There was a similar problem with the King, and I fixed both. The problem was with the functions for ascertaining the range of the piece, which were used only for potential moves. When I tried to make moves, they worked, and what I needed to fix were the NL, nL, KL, and kL functions. Here is an example of what was no longer working:
def NL array where #0 1 2 where #0 2 1 where #0 -1 -2 where #0 -2 -1 where #0 1 -3 where #0 -1 3 where #0 -3 1 where #0 3 -1 where #0 2 -3 where #0 -2 3 where #0 -3 2 where #0 3 -2;
I believe the problem arose if any of these where clauses returned false instead of a coordinate. To get around that, I replaced the code with this:
This uses the aggregate function to build an array of non-empty values of the lambda function, and it passes it the same set of values as the previous code did. So, whenever the where function returns false, it doesn't get added to the array.
There was a similar problem with the King, and I fixed both. The problem was with the functions for ascertaining the range of the piece, which were used only for potential moves. When I tried to make moves, they worked, and what I needed to fix were the NL, nL, KL, and kL functions. Here is an example of what was no longer working:
def NL array where #0 1 2 where #0 2 1 where #0 -1 -2 where #0 -2 -1 where #0 1 -3 where #0 -1 3 where #0 -3 1 where #0 3 -1 where #0 2 -3 where #0 -2 3 where #0 -3 2 where #0 3 -2;
I believe the problem arose if any of these
where
clauses returned false instead of a coordinate. To get around that, I replaced the code with this:def NL aggregate lambda (where #frm #0 #1) ((1 2) (2 1) (-1 -2) (-2 -1) (1 -3) (-1 3) (-3 1) (3 -1) (2 -3) (-2 3) (-3 2) (3 -2)) =frm;
This uses the aggregate function to build an array of non-empty values of the lambda function, and it passes it the same set of values as the previous code did. So, whenever the
where
function returns false, it doesn't get added to the array.