legal_move
legal_move checks whether a move is legal.
Contents
Syntax
answer = legal_move
Description
It is checked whether a chess figures move (stored in global structure cursor) is legal or not.
Note: That this function calls the chess figure class identified by the figure which is on the "from" field. This function
is called from the stopCursor event-function.
Inputs:
- global cursor ... cursor information (contains the move "from" "to")
- global board ... chess board and related information
Outputs:
- answer ... Boolean answer (1... legal move, 0 ... not allowed)
Example
Assume there is a global board information, describing the chess board and a global cursor structure. The cursor structure
contains the fields from and to. The function legal_move will check whether the move "cursor.from" to "cursor.to" is legal.
See also
King, Queen, Knight, Bishop, Rook, Pawn, stopCursor
Signature