diff -r d726e4b46c33 -r 0cedda2544da src/chess/rules.h --- a/src/chess/rules.h Wed May 28 15:47:57 2014 +0200 +++ b/src/chess/rules.h Wed Jun 11 15:38:01 2014 +0200 @@ -33,13 +33,16 @@ #include #include -#define VALID_MOVE_SYNTAX 0 -#define INVALID_MOVE_SYNTAX 1 -#define INVALID_POSITION 2 -#define AMBIGUOUS_MOVE 3 -#define NEED_PROMOTION 4 -#define PIECE_PINNED 5 -#define KING_IN_CHECK 6 +#define VALID_MOVE_SYNTAX 0 +#define VALID_MOVE_SEMANTICS 0 /* use same code for a success */ +#define INVALID_MOVE_SYNTAX 1 +#define INVALID_POSITION 2 +#define AMBIGUOUS_MOVE 3 +#define NEED_PROMOTION 4 +#define PIECE_PINNED 5 +#define KING_IN_CHECK 6 +#define KING_MOVES_INTO_CHECK 7 +#define RULES_VIOLATED 10 #define PIECE_MASK 0x0F @@ -268,7 +271,7 @@ * @param gamestate the current game state * @param mstr the input string to parse * @param move a pointer to object where the move data shall be stored - * @return status code (see rules/rules.h for the list of codes) + * @return status code (see macros in this file for the list of codes) */ int eval_move(GameState *gamestate, char *mstr, Move *move); @@ -276,9 +279,9 @@ * Validates move by applying chess rules. * @param gamestate the current game state * @param move the move to validate - * @return TRUE, if the move complies to chess rules, FALSE otherwise + * @return status code (see macros in this file for the list of codes) */ -_Bool validate_move(GameState *gamestate, Move *move); +int validate_move(GameState *gamestate, Move *move); /** * Applies a move and deletes captured pieces.