Chess 0.0.1
A library written in c
Loading...
Searching...
No Matches
move.h
Go to the documentation of this file.
1
8#ifndef CHESS_MOVE_H_INCLUDED
9#define CHESS_MOVE_H_INCLUDED
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
16#include <chess/piece.h>
17#include <chess/piece_type.h>
18#include <chess/position.h>
19#include <chess/square.h>
20
21#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 202311L
22 #include <stdbool.h>
23#endif
24#include <stddef.h>
25
39
45
52
62
70size_t chess_move_from_algebraic(const ChessPosition *position, ChessMove *move, const char *string);
71
80size_t chess_move_to_algebraic(const ChessPosition *position, ChessMove move, char *string, size_t string_size);
81
88bool chess_move_is_legal(const ChessPosition *position, ChessMove move);
89
97
105
113
121
129
137
145
146#ifdef __cplusplus
147}
148#endif
149
150#endif // CHESS_MOVE_H_INCLUDED
Defines the chess castling rights type and related utility functions for representing and manipulatin...
ChessCastlingRights
Represents the castling rights in a chess game.
Definition castling_rights.h:22
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_undo(ChessPosition *position, ChessMove move)
Undoes the given move on the given position if legal.
void chess_move_debug(ChessMove move)
Prints a debug representation of the given move.
ChessMove chess_move_new(const ChessPosition *position, ChessSquare from, ChessSquare to, ChessPieceType promotion_type)
Creates a new move for the given position.
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_is_capture(const ChessPosition *position, ChessMove move)
Checks if the given move is a capture.
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_kingside_castling(const ChessPosition *position, ChessMove move)
Checks if the given move is kingside castling.
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_valid(ChessMove move)
Checks if the given move is valid.
bool chess_move_is_promotion(const ChessPosition *position, ChessMove move)
Checks if the given move is a promotion.
Defines the chess piece type and related utility functions for representing and manipulating chess pi...
ChessPiece
Definition piece.h:28
Defines the chess piece type type and related utility functions for representing and manipulating che...
ChessPieceType
Represents the types of chess pieces.
Definition piece_type.h:27
Defines the chess position type and related utility functions for representing and manipulating chess...
Defines the chess square type and related utility functions for representing and manipulating chess s...
ChessSquare
Represents the squares on a chess board, from A1 to H8.
Definition square.h:35
Represents a move in a chess game.
Definition move.h:30
ChessPieceType promotion_type
Definition move.h:33
ChessSquare to
Definition move.h:32
ChessPiece captured_piece
Definition move.h:34
ChessSquare previous_en_passant_square
Definition move.h:36
ChessCastlingRights previous_castling_rights
Definition move.h:35
unsigned int previous_half_move_clock
Definition move.h:37
ChessSquare from
Definition move.h:31
Represents the position in a chess game.
Definition position.h:30