| 487 * |
486 * |
| 488 * When short algebraic notation is used, the source position is determined by |
487 * When short algebraic notation is used, the source position is determined by |
| 489 * evaluating the allowed moves according to the current game state. |
488 * evaluating the allowed moves according to the current game state. |
| 490 * |
489 * |
| 491 * This function expects correct notation of check and checkmate indicators. |
490 * This function expects correct notation of check and checkmate indicators. |
| 492 * For a more lazy evaluation, use eval_move_lazy(). |
491 * For a more lazy evaluation, use eval_move(). |
| 493 * |
492 * |
| 494 * For a purely syntactic check, regardless of whether a piece exists that is |
493 * For a purely syntactic check, regardless of whether a piece exists that is |
| 495 * allowed to move that way, use check_move(). |
494 * allowed to move that way, use check_move(). |
| 496 * |
495 * |
| 497 * @param gamestate the current game state |
496 * @param gamestate the current game state |
| 498 * @param mstr the input string to parse |
497 * @param mstr the input string to parse |
| 499 * @param color the color of the player to evaluate the move for |
498 * @param color the color of the player to evaluate the move for |
| 500 * @param move a pointer to object where the move data shall be stored |
499 * @param move a pointer to object where the move data shall be stored |
| 501 * @return status code (see macros in this file for the list of codes) |
500 * @return status code (see macros in this file for the list of codes) |
| 502 */ |
501 */ |
| 503 int eval_move(const GameState *gamestate, |
502 int eval_move_strict(const GameState *gamestate, |
| 504 const char *mstr, Color color, Move *move); |
503 const char *mstr, Color color, Move *move); |
| 505 |
504 |
| 506 /** |
505 /** |
| 507 * Evaluates a move syntactically and stores the move data in the specified |
506 * Evaluates a move syntactically and stores the move data in the specified |
| 508 * object. |
507 * object. |
| 509 * |
508 * |
| 510 * When short algebraic notation is used, the source position is determined by |
509 * When short algebraic notation is used, the source position is determined by |
| 511 * evaluating the allowed moves according to the current game state. |
510 * evaluating the allowed moves according to the current game state. |
| 512 * |
511 * |
| 513 * This function automatically corrects missing or incorrect check/checkmate |
512 * This function automatically corrects missing or incorrect check/checkmate |
| 514 * indicators. Use eval_move() if you want to keep the original notation. |
513 * indicators. Use eval_move_strict() if you want to keep the original notation. |
| 515 * |
514 * |
| 516 * For a purely syntactic check, regardless of whether a piece exists that is |
515 * For a purely syntactic check, regardless of whether a piece exists that is |
| 517 * allowed to move that way, use check_move(). |
516 * allowed to move that way, use check_move(). |
| 518 * |
517 * |
| 519 * @param gamestate the current game state |
518 * @param gamestate the current game state |
| 520 * @param mstr the input string to parse |
519 * @param mstr the input string to parse |
| 521 * @param color the color of the player to evaluate the move for |
520 * @param color the color of the player to evaluate the move for |
| 522 * @param move a pointer to object where the move data shall be stored |
521 * @param move a pointer to object where the move data shall be stored |
| 523 * @return status code (see macros in this file for the list of codes) |
522 * @return status code (see macros in this file for the list of codes) |
| 524 */ |
523 */ |
| 525 int eval_move_lazy(const GameState *gamestate, |
524 int eval_move(const GameState *gamestate, |
| 526 const char *mstr, Color color, Move *move); |
525 const char *mstr, Color color, Move *move); |
| |
526 |
| |
527 /** |
| |
528 * Calculates the move string within the specified move. |
| |
529 * |
| |
530 * This corrects any missing check / checkmate flags, first. |
| |
531 * |
| |
532 * Do not call this function after eval_move() or eval_move_strict(). |
| |
533 * |
| |
534 * @param gamestate the current game state |
| |
535 * @param move the move data |
| |
536 */ |
| |
537 void format_move(const GameState *gamestate, Move *move); |
| 527 |
538 |
| 528 /** |
539 /** |
| 529 * Syntactically checks a move without verifying that a piece exists that is |
540 * Syntactically checks a move without verifying that a piece exists that is |
| 530 * allowed to move that way. |
541 * allowed to move that way. |
| 531 * |
542 * |