Chess 0.0.1
A library written in c
Loading...
Searching...
No Matches
rank.h
Go to the documentation of this file.
1
8#ifndef CHESS_RANK_H_INCLUDED
9#define CHESS_RANK_H_INCLUDED
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15#include <chess/macros.h>
16
17#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 202311L
18 #include <stdbool.h>
19#endif
20#include <stddef.h>
21#include <stdint.h>
22
39
45
52
59size_t chess_rank_from_algebraic(ChessRank *rank, const char *string);
60
68size_t chess_rank_to_algebraic(ChessRank rank, char *string, size_t string_size);
69
70#ifdef __cplusplus
71}
72#endif
73
74#endif // CHESS_RANK_H_INCLUDED
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
bool chess_rank_is_valid(ChessRank rank)
Checks if the given rank is valid (1-8).
void chess_rank_debug(ChessRank rank)
Prints a debug representation of the given rank.
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
size_t chess_rank_from_algebraic(ChessRank *rank, const char *string)
Parses a rank from algebraic notation (e.g., "1", "2", ..., "8").
size_t chess_rank_to_algebraic(ChessRank rank, char *string, size_t string_size)
Converts a rank to algebraic notation (e.g., "1", "2", ..., "8").