Code covered by the BSD License  

Highlights from
Chess with "Greedy Edi"

image thumbnail

Chess with "Greedy Edi"

by

 

07 Nov 2009 (Updated )

Play chess against "Greedy Edi".

legal_move

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

  • Copyright 2006 W.Garn

Contact us