|
Chess 0.0.1
A library written in c
|
Defines the chess move type and related utility functions for representing and manipulating chess moves. More...
#include <chess/castling_rights.h>#include <chess/piece.h>#include <chess/piece_type.h>#include <chess/position.h>#include <chess/square.h>#include <stdbool.h>#include <stddef.h>Go to the source code of this file.
Data Structures | |
| struct | ChessMove |
| Represents a move in a chess game. More... | |
Typedefs | |
| typedef struct ChessMove | ChessMove |
Functions | |
| void | chess_move_debug (ChessMove move) |
| Prints a debug representation of the given move. | |
| bool | chess_move_is_valid (ChessMove move) |
| Checks if the given move is valid. | |
| ChessMove | chess_move_new (const ChessPosition *position, ChessSquare from, ChessSquare to, ChessPieceType promotion_type) |
| Creates a new move for the given position. | |
| size_t | chess_move_from_algebraic (const ChessPosition *position, ChessMove *move, const char *string) |
| Parses a move from algebraic notation. | |
| size_t | chess_move_to_algebraic (const ChessPosition *position, ChessMove move, char *string, size_t string_size) |
| Converts a move to algebraic notation. | |
| bool | chess_move_is_legal (const ChessPosition *position, ChessMove move) |
| Checks if the given move is legal in the given position. | |
| bool | chess_move_is_promotion (const ChessPosition *position, ChessMove move) |
| Checks if the given move is a promotion. | |
| bool | chess_move_is_en_passant (const ChessPosition *position, ChessMove move) |
| Checks if the given move is an en passant capture. | |
| bool | chess_move_is_capture (const ChessPosition *position, ChessMove move) |
| Checks if the given move is a capture. | |
| bool | chess_move_is_kingside_castling (const ChessPosition *position, ChessMove move) |
| Checks if the given move is kingside castling. | |
| bool | chess_move_is_queenside_castling (const ChessPosition *position, ChessMove move) |
| Checks if the given move is queenside castling. | |
| bool | chess_move_do (ChessPosition *position, ChessMove move) |
| Does the given move on the given position if legal. | |
| bool | chess_move_undo (ChessPosition *position, ChessMove move) |
| Undoes the given move on the given position if legal. | |
Defines the chess move type and related utility functions for representing and manipulating chess moves.
| void chess_move_debug | ( | ChessMove | move | ) |
Prints a debug representation of the given move.
| [in] | move | The move to print. |
| bool chess_move_do | ( | ChessPosition * | position, |
| ChessMove | move | ||
| ) |
Does the given move on the given position if legal.
| [in,out] | position | Pointer to the position to update. |
| [in] | move | The move to make. |
| size_t chess_move_from_algebraic | ( | const ChessPosition * | position, |
| ChessMove * | move, | ||
| const char * | string | ||
| ) |
Parses a move from algebraic notation.
| [in] | position | Pointer to the position, the move is for. |
| [out] | move | Pointer to store the parsed move. |
| [in] | string | The string containing the algebraic notation. |
| bool chess_move_is_capture | ( | const ChessPosition * | position, |
| ChessMove | move | ||
| ) |
Checks if the given move is a capture.
| [in] | position | Pointer to the position, the move is for. |
| [in] | move | The move to check. |
| bool chess_move_is_en_passant | ( | const ChessPosition * | position, |
| ChessMove | move | ||
| ) |
Checks if the given move is an en passant capture.
| [in] | position | Pointer to the position, the move is for. |
| [in] | move | The move to check. |
| bool chess_move_is_kingside_castling | ( | const ChessPosition * | position, |
| ChessMove | move | ||
| ) |
Checks if the given move is kingside castling.
| [in] | position | Pointer to the position, the move is for. |
| [in] | move | The move to check. |
| bool chess_move_is_legal | ( | const ChessPosition * | position, |
| ChessMove | move | ||
| ) |
Checks if the given move is legal in the given position.
| [in] | position | Pointer to the position, the move is for. |
| [in] | move | The move to check. |
| bool chess_move_is_promotion | ( | const ChessPosition * | position, |
| ChessMove | move | ||
| ) |
Checks if the given move is a promotion.
| [in] | position | Pointer to the position, the move is for. |
| [in] | move | The move to check. |
| bool chess_move_is_queenside_castling | ( | const ChessPosition * | position, |
| ChessMove | move | ||
| ) |
Checks if the given move is queenside castling.
| [in] | position | Pointer to the position, the move is for. |
| [in] | move | The move to check. |
| bool chess_move_is_valid | ( | ChessMove | move | ) |
Checks if the given move is valid.
| [in] | move | The move to check. |
| ChessMove chess_move_new | ( | const ChessPosition * | position, |
| ChessSquare | from, | ||
| ChessSquare | to, | ||
| ChessPieceType | promotion_type | ||
| ) |
Creates a new move for the given position.
| [in] | position | Pointer to the position. |
| [in] | from | The source square. |
| [in] | to | The destination square. |
| [in] | promotion_type | The type of piece to promote to, or CHESS_PIECE_TYPE_NONE if not a promotion. |
| size_t chess_move_to_algebraic | ( | const ChessPosition * | position, |
| ChessMove | move, | ||
| char * | string, | ||
| size_t | string_size | ||
| ) |
Converts a move to algebraic notation.
| [in] | position | Pointer to the position, the move is for. |
| [in] | move | The move to convert. |
| [out] | string | The buffer to store the algebraic notation. |
| [in] | string_size | The size of the output buffer. |
| bool chess_move_undo | ( | ChessPosition * | position, |
| ChessMove | move | ||
| ) |
Undoes the given move on the given position if legal.
| [in,out] | position | Pointer to the position to update. |
| [in] | move | The move to undo. |