8#ifndef CHESS_SQUARE_H_INCLUDED
9#define CHESS_SQUARE_H_INCLUDED
20#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 202311L
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
Defines the chess file type and related utility functions for representing and manipulating chess fil...
ChessFile
Represents the files (columns) on a chess board, from A to H.
Definition file.h:27
@ CHESS_FILE_A
Definition file.h:28
@ CHESS_FILE_F
Definition file.h:33
@ CHESS_FILE_G
Definition file.h:34
@ CHESS_FILE_H
Definition file.h:35
@ CHESS_FILE_E
Definition file.h:32
@ CHESS_FILE_B
Definition file.h:29
@ CHESS_FILE_C
Definition file.h:30
@ CHESS_FILE_NONE
Definition file.h:37
@ CHESS_FILE_D
Definition file.h:31
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
Defines the chess rank type and related utility functions for representing and manipulating chess ran...
ChessRank
Represents the ranks (rows) on a chess board, from 1 to 8.
Definition rank.h:27
@ CHESS_RANK_2
Definition rank.h:29
@ CHESS_RANK_8
Definition rank.h:35
@ CHESS_RANK_1
Definition rank.h:28
@ CHESS_RANK_7
Definition rank.h:34
@ CHESS_RANK_3
Definition rank.h:30
@ CHESS_RANK_NONE
Definition rank.h:37
@ CHESS_RANK_5
Definition rank.h:32
@ CHESS_RANK_6
Definition rank.h:33
@ CHESS_RANK_4
Definition rank.h:31
bool chess_square_is_attacked(const ChessPosition *position, ChessSquare square, ChessColor color)
Checks if the given square is attacked by a given color in a position.
ChessSquare chess_square_new(ChessFile file, ChessRank rank)
Creates a new square from a file and rank.
ChessSquare
Represents the squares on a chess board, from A1 to H8.
Definition square.h:35
@ CHESS_SQUARE_A8
Definition square.h:99
@ CHESS_SQUARE_E7
Definition square.h:94
@ CHESS_SQUARE_G5
Definition square.h:78
@ CHESS_SQUARE_G8
Definition square.h:105
@ CHESS_SQUARE_B4
Definition square.h:64
@ CHESS_SQUARE_H4
Definition square.h:70
@ CHESS_SQUARE_D8
Definition square.h:102
@ CHESS_SQUARE_E1
Definition square.h:40
@ CHESS_SQUARE_D4
Definition square.h:66
@ CHESS_SQUARE_C1
Definition square.h:38
@ CHESS_SQUARE_F6
Definition square.h:86
@ CHESS_SQUARE_F8
Definition square.h:104
@ CHESS_SQUARE_D3
Definition square.h:57
@ CHESS_SQUARE_D7
Definition square.h:93
@ CHESS_SQUARE_D6
Definition square.h:84
@ CHESS_SQUARE_B5
Definition square.h:73
@ CHESS_SQUARE_B7
Definition square.h:91
@ CHESS_SQUARE_D2
Definition square.h:48
@ CHESS_SQUARE_A7
Definition square.h:90
@ CHESS_SQUARE_C8
Definition square.h:101
@ CHESS_SQUARE_C3
Definition square.h:56
@ CHESS_SQUARE_F5
Definition square.h:77
@ CHESS_SQUARE_NONE
Definition square.h:108
@ CHESS_SQUARE_H5
Definition square.h:79
@ CHESS_SQUARE_F3
Definition square.h:59
@ CHESS_SQUARE_G4
Definition square.h:69
@ CHESS_SQUARE_H3
Definition square.h:61
@ CHESS_SQUARE_E5
Definition square.h:76
@ CHESS_SQUARE_F1
Definition square.h:41
@ CHESS_SQUARE_G1
Definition square.h:42
@ CHESS_SQUARE_B1
Definition square.h:37
@ CHESS_SQUARE_E4
Definition square.h:67
@ CHESS_SQUARE_G2
Definition square.h:51
@ CHESS_SQUARE_C7
Definition square.h:92
@ CHESS_SQUARE_G3
Definition square.h:60
@ CHESS_SQUARE_A2
Definition square.h:45
@ CHESS_SQUARE_F7
Definition square.h:95
@ CHESS_SQUARE_D5
Definition square.h:75
@ CHESS_SQUARE_F2
Definition square.h:50
@ CHESS_SQUARE_H2
Definition square.h:52
@ CHESS_SQUARE_B6
Definition square.h:82
@ CHESS_SQUARE_C4
Definition square.h:65
@ CHESS_SQUARE_G7
Definition square.h:96
@ CHESS_SQUARE_C2
Definition square.h:47
@ CHESS_SQUARE_A6
Definition square.h:81
@ CHESS_SQUARE_A5
Definition square.h:72
@ CHESS_SQUARE_F4
Definition square.h:68
@ CHESS_SQUARE_H1
Definition square.h:43
@ CHESS_SQUARE_E8
Definition square.h:103
@ CHESS_SQUARE_A3
Definition square.h:54
@ CHESS_SQUARE_H7
Definition square.h:97
@ CHESS_SQUARE_C5
Definition square.h:74
@ CHESS_SQUARE_B8
Definition square.h:100
@ CHESS_SQUARE_H8
Definition square.h:106
@ CHESS_SQUARE_E3
Definition square.h:58
@ CHESS_SQUARE_A4
Definition square.h:63
@ CHESS_SQUARE_D1
Definition square.h:39
@ CHESS_SQUARE_G6
Definition square.h:87
@ CHESS_SQUARE_A1
Definition square.h:36
@ CHESS_SQUARE_E6
Definition square.h:85
@ CHESS_SQUARE_B3
Definition square.h:55
@ CHESS_SQUARE_C6
Definition square.h:83
@ CHESS_SQUARE_B2
Definition square.h:46
@ CHESS_SQUARE_H6
Definition square.h:88
@ CHESS_SQUARE_E2
Definition square.h:49
bool chess_square_is_valid(ChessSquare square)
Checks if the given square is valid (A1-H8).
ChessColor chess_square_color(ChessSquare square)
Gets the color of the given square.
size_t chess_square_to_algebraic(ChessSquare square, char *string, size_t string_size)
Converts a square to algebraic notation (e.g., "a1", "b1", ..., "h8").
ChessRank chess_square_rank(ChessSquare square)
Gets the rank of the given square.
size_t chess_square_from_algebraic(ChessSquare *square, const char *string)
Parses a square from algebraic notation (e.g., "a1", "b1", ..., "h8").
void chess_square_debug(ChessSquare square)
Prints a debug representation of the given square.
ChessFile chess_square_file(ChessSquare square)
Gets the file of the given square.
Represents the position in a chess game.
Definition position.h:30