This is a test for how to implement immobilizers with the Interactive Diagram,
through a user-supplied function BadZone().
The Queen here immobilizes all adjacent enemy pieces.
This was already possible before,
by having the function BadZone() examine all board squares adjacent to the origin of the move,
and vetoing the move (by returning non-zero) when an enemy immobilizer was found there.
This was quite inefficient, though, as it would be done for every potential move of the immobilized piece.
I now changed the Diagram Script such that BadZone() can remember the result of any test it does in a variable 'frozen',
set to -1 whenever move generation for a new piece starts.
So that it can get the result of a previous test for the same piece from there,
rather than redoing the test.
And by setting frozen = 100 it can even abort generation of moves for the current piece altogether.
This is a test for how to implement immobilizers with the Interactive Diagram, through a user-supplied function BadZone(). The Queen here immobilizes all adjacent enemy pieces.
This was already possible before, by having the function BadZone() examine all board squares adjacent to the origin of the move, and vetoing the move (by returning non-zero) when an enemy immobilizer was found there. This was quite inefficient, though, as it would be done for every potential move of the immobilized piece.
I now changed the Diagram Script such that BadZone() can remember the result of any test it does in a variable 'frozen', set to -1 whenever move generation for a new piece starts. So that it can get the result of a previous test for the same piece from there, rather than redoing the test. And by setting frozen = 100 it can even abort generation of moves for the current piece altogether.