Chess 0.0.1
A library written in c
|
Defines the chess position counter type and related functions for keeping count of position occurences. More...
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
Go to the source code of this file.
Data Structures | |
struct | ChessPositionCounterEntry |
Entry in the position counter hash table. More... | |
struct | ChessPositionCounter |
Hash table for counting chess positions. More... | |
Typedefs | |
typedef struct ChessPosition | ChessPosition |
Forward declaration of ChessPosition. | |
typedef struct ChessPositionCounterEntry | ChessPositionCounterEntry |
Entry in the position counter hash table. | |
typedef struct ChessPositionCounter | ChessPositionCounter |
Hash table for counting chess positions. | |
Functions | |
bool | chess_position_counter_is_valid (const ChessPositionCounter *counter) |
Checks if the given position counter is valid. | |
ChessPositionCounter | chess_position_counter_new (void) |
Creates a new, empty position counter. | |
void | chess_position_counter_drop (ChessPositionCounter *counter) |
Releases resources held by the given position counter. | |
void | chess_position_counter_clear (ChessPositionCounter *counter) |
Clears all entries from the given position counter. | |
unsigned int | chess_position_counter_count (const ChessPositionCounter *counter, const ChessPosition *position) |
Gets the count for a given position. | |
bool | chess_position_counter_increment (ChessPositionCounter *counter, const ChessPosition *position) |
Increments the count for a given position. | |
bool | chess_position_counter_decrement (ChessPositionCounter *counter, const ChessPosition *position) |
Decrements the count for a given position. | |
Defines the chess position counter type and related functions for keeping count of position occurences.
typedef struct ChessPositionCounter ChessPositionCounter |
Hash table for counting chess positions.
Used to track the number of times each position has occurred, typically for threefold repetition detection.
typedef struct ChessPositionCounterEntry ChessPositionCounterEntry |
Entry in the position counter hash table.
Stores a position key and its associated count.
void chess_position_counter_clear | ( | ChessPositionCounter * | counter | ) |
Clears all entries from the given position counter.
[in,out] | counter | Pointer to the position counter to clear. |
unsigned int chess_position_counter_count | ( | const ChessPositionCounter * | counter, |
const ChessPosition * | position | ||
) |
Gets the count for a given position.
[in] | counter | Pointer to the position counter. |
[in] | position | Pointer to the position. |
bool chess_position_counter_decrement | ( | ChessPositionCounter * | counter, |
const ChessPosition * | position | ||
) |
Decrements the count for a given position.
[in,out] | counter | Pointer to the position counter. |
[in] | position | Pointer to the position. |
void chess_position_counter_drop | ( | ChessPositionCounter * | counter | ) |
Releases resources held by the given position counter.
[in,out] | counter | Pointer to the position counter to drop. |
bool chess_position_counter_increment | ( | ChessPositionCounter * | counter, |
const ChessPosition * | position | ||
) |
Increments the count for a given position.
[in,out] | counter | Pointer to the position counter. |
[in] | position | Pointer to the position. |
bool chess_position_counter_is_valid | ( | const ChessPositionCounter * | counter | ) |
Checks if the given position counter is valid.
[in] | counter | Pointer to the position counter to check. |
ChessPositionCounter chess_position_counter_new | ( | void | ) |
Creates a new, empty position counter.