|
Chess 0.0.1
A library written in c
|
Defines the chess position type and related utility functions for representing and manipulating chess positions. More...
#include <chess/castling_rights.h>#include <chess/color.h>#include <chess/piece.h>#include <chess/position_counter.h>#include <chess/square.h>#include <stdbool.h>#include <stdint.h>Go to the source code of this file.
Data Structures | |
| struct | ChessPosition |
| Represents the position in a chess game. More... | |
Typedefs | |
| typedef struct ChessPosition | ChessPosition |
Functions | |
| void | chess_position_debug (const ChessPosition *position) |
| Prints a debug representation of the given position. | |
| bool | chess_position_is_valid (const ChessPosition *position) |
| Checks if the given position is valid. | |
| ChessPosition | chess_position_new (void) |
| Creates a new position initialized to the standard starting position. | |
| void | chess_position_drop (ChessPosition *position) |
| Releases resources held by the given position. | |
| ChessPiece | chess_position_piece_at_square (const ChessPosition *position, ChessSquare square) |
| Gets the piece at the given square in the given position. | |
| ChessColor | chess_position_side_to_move (const ChessPosition *position) |
| Gets the side to move in the given position. | |
| size_t | chess_position_from_fen (ChessPosition *position, const char *string) |
| Parses a position from FEN notation (e.g., "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"). | |
| size_t | chess_position_to_fen (const ChessPosition *position, char *string, size_t string_size) |
| Converts a position to FEN notation (e.g., "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"). | |
| bool | chess_position_is_check (const ChessPosition *position) |
| Checks if the current side to move is in check. | |
| bool | chess_position_is_checkmate (const ChessPosition *position) |
| Checks if the current side to move is in checkmate. | |
| bool | chess_position_is_stalemate (const ChessPosition *position) |
| Checks if the current position is a stalemate. | |
| bool | chess_position_is_fifty_move_rule (const ChessPosition *position) |
| Checks if the fifty-move rule applies to the current position. | |
| bool | chess_position_is_threefold_repetition (const ChessPosition *position) |
| Checks if the current position has occurred three or more times (threefold repetition). | |
| bool | chess_position_is_insufficient_material (const ChessPosition *position) |
| Checks if there is insufficient material to checkmate. | |
| uint64_t | chess_position_hash (const ChessPosition *position) |
| Computes a hash value for the given position. | |
| double | chess_position_evaluate (const ChessPosition *position) |
| Evaluates the given position. | |
Defines the chess position type and related utility functions for representing and manipulating chess positions.
| void chess_position_debug | ( | const ChessPosition * | position | ) |
Prints a debug representation of the given position.
| [in] | position | Pointer to the position to print. |
| void chess_position_drop | ( | ChessPosition * | position | ) |
Releases resources held by the given position.
| [in,out] | position | Pointer to the position to drop. |
| double chess_position_evaluate | ( | const ChessPosition * | position | ) |
Evaluates the given position.
| [in] | position | Pointer to the position. |
| size_t chess_position_from_fen | ( | ChessPosition * | position, |
| const char * | string | ||
| ) |
Parses a position from FEN notation (e.g., "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1").
| [out] | position | Pointer to store the parsed position. |
| [in] | string | The string containing the FEN notation. |
| uint64_t chess_position_hash | ( | const ChessPosition * | position | ) |
Computes a hash value for the given position.
| [in] | position | Pointer to the position. |
| bool chess_position_is_check | ( | const ChessPosition * | position | ) |
Checks if the current side to move is in check.
| [in] | position | Pointer to the position. |
| bool chess_position_is_checkmate | ( | const ChessPosition * | position | ) |
Checks if the current side to move is in checkmate.
| [in] | position | Pointer to the position. |
| bool chess_position_is_fifty_move_rule | ( | const ChessPosition * | position | ) |
Checks if the fifty-move rule applies to the current position.
| [in] | position | Pointer to the position. |
| bool chess_position_is_insufficient_material | ( | const ChessPosition * | position | ) |
Checks if there is insufficient material to checkmate.
| [in] | position | Pointer to the position. |
| bool chess_position_is_stalemate | ( | const ChessPosition * | position | ) |
Checks if the current position is a stalemate.
| [in] | position | Pointer to the position. |
| bool chess_position_is_threefold_repetition | ( | const ChessPosition * | position | ) |
Checks if the current position has occurred three or more times (threefold repetition).
| [in] | position | Pointer to the position. |
| bool chess_position_is_valid | ( | const ChessPosition * | position | ) |
Checks if the given position is valid.
| [in] | position | Pointer to the position to check. |
| ChessPosition chess_position_new | ( | void | ) |
Creates a new position initialized to the standard starting position.
| ChessPiece chess_position_piece_at_square | ( | const ChessPosition * | position, |
| ChessSquare | square | ||
| ) |
Gets the piece at the given square in the given position.
| [in] | position | Pointer to the position. |
| [in] | square | The square. |
| ChessColor chess_position_side_to_move | ( | const ChessPosition * | position | ) |
Gets the side to move in the given position.
| [in] | position | Pointer to the position. |
| size_t chess_position_to_fen | ( | const ChessPosition * | position, |
| char * | string, | ||
| size_t | string_size | ||
| ) |
Converts a position to FEN notation (e.g., "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1").
| [in] | position | Pointer to the position to convert. |
| [out] | string | The buffer to store the FEN notation. |
| [in] | string_size | The size of the output buffer. |