Chess 0.0.1
A library written in c
Loading...
Searching...
No Matches
piece.h
Go to the documentation of this file.
1
8#ifndef CHESS_PIECE_H_INCLUDED
9#define CHESS_PIECE_H_INCLUDED
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15#include <chess/color.h>
16#include <chess/macros.h>
17#include <chess/piece_type.h>
18
19#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 202311L
20 #include <stdbool.h>
21#endif
22#include <stdint.h>
23
45
51
58
66
73
80
87size_t chess_piece_from_algebraic(ChessPiece *piece, const char *string);
88
96size_t chess_piece_to_algebraic(ChessPiece piece, char *string, size_t string_size);
97
98#ifdef __cplusplus
99}
100#endif
101
102#endif // CHESS_PIECE_H_INCLUDED
Defines the chess color type and related utility functions for representing and manipulating chess co...
ChessColor
Represents the color of a chess piece, square or player.
Definition color.h:26
@ CHESS_COLOR_BLACK
Definition color.h:28
@ CHESS_COLOR_WHITE
Definition color.h:27
@ CHESS_COLOR_NONE
Definition color.h:30
Defines macros and constants for the library.
#define CHESS_ENUM(type, name)
Defines a typed enum or a typedef enum based on the availability of typed enums in the compiler.
Definition macros.h:84
ChessPieceType chess_piece_type(ChessPiece piece)
Gets the type of the given piece.
ChessColor chess_piece_color(ChessPiece piece)
Gets the color of the given piece.
void chess_piece_debug(ChessPiece piece)
Prints a debug representation of the given piece.
ChessPiece chess_piece_new(ChessColor color, ChessPieceType type)
Creates a piece from a color and piece type.
ChessPiece
Definition piece.h:28
@ CHESS_PIECE_BLACK_ROOK
Definition piece.h:39
@ CHESS_PIECE_BLACK_PAWN
Definition piece.h:36
@ CHESS_PIECE_NONE
Definition piece.h:43
@ CHESS_PIECE_BLACK_KNIGHT
Definition piece.h:37
@ CHESS_PIECE_WHITE_BISHOP
Definition piece.h:31
@ CHESS_PIECE_WHITE_ROOK
Definition piece.h:32
@ CHESS_PIECE_BLACK_BISHOP
Definition piece.h:38
@ CHESS_PIECE_WHITE_QUEEN
Definition piece.h:33
@ CHESS_PIECE_WHITE_KING
Definition piece.h:34
@ CHESS_PIECE_WHITE_PAWN
Definition piece.h:29
@ CHESS_PIECE_BLACK_KING
Definition piece.h:41
@ CHESS_PIECE_WHITE_KNIGHT
Definition piece.h:30
@ CHESS_PIECE_BLACK_QUEEN
Definition piece.h:40
bool chess_piece_is_valid(ChessPiece piece)
Checks if the given piece is valid.
size_t chess_piece_to_algebraic(ChessPiece piece, char *string, size_t string_size)
Converts a piece to algebraic notation (e.g., "P", "N", ..., "K", "p", "n", ..., "k").
size_t chess_piece_from_algebraic(ChessPiece *piece, const char *string)
Parses a piece from algebraic notation (e.g., "P", "N", ..., "K", "p", "n", ..., "k").
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
@ CHESS_PIECE_TYPE_PAWN
Definition piece_type.h:28
@ CHESS_PIECE_TYPE_ROOK
Definition piece_type.h:31
@ CHESS_PIECE_TYPE_BISHOP
Definition piece_type.h:30
@ CHESS_PIECE_TYPE_KNIGHT
Definition piece_type.h:29
@ CHESS_PIECE_TYPE_QUEEN
Definition piece_type.h:32
@ CHESS_PIECE_TYPE_NONE
Definition piece_type.h:35
@ CHESS_PIECE_TYPE_KING
Definition piece_type.h:33