Chess 0.0.1
A library written in c
Loading...
Searching...
No Matches
color.h File Reference

Defines the chess color type and related utility functions for representing and manipulating chess colors. More...

#include <chess/macros.h>
#include <stdbool.h>
#include <stdint.h>

Go to the source code of this file.

Enumerations

enum  ChessColor : uint8_t {
  CHESS_COLOR_WHITE = 0 ,
  CHESS_COLOR_BLACK = 1 ,
  CHESS_COLOR_NONE = 2
}
 Represents the color of a chess piece, square or player. More...
 

Functions

void chess_color_debug (ChessColor color)
 Prints a debug representation of the given color.
 
bool chess_color_is_valid (ChessColor color)
 Checks if the given color is valid (white or black).
 
ChessColor chess_color_opposite (ChessColor color)
 Returns the opposite color (white <-> black).
 

Detailed Description

Defines the chess color type and related utility functions for representing and manipulating chess colors.

Author
Tarek Saeed
Date
2025-06-14

Enumeration Type Documentation

◆ ChessColor

enum ChessColor : uint8_t

Represents the color of a chess piece, square or player.

Enumerator
CHESS_COLOR_WHITE 

White color

CHESS_COLOR_BLACK 

Black color

CHESS_COLOR_NONE 

No color

Function Documentation

◆ chess_color_debug()

void chess_color_debug ( ChessColor  color)

Prints a debug representation of the given color.

Parameters
colorThe color to print.

◆ chess_color_is_valid()

bool chess_color_is_valid ( ChessColor  color)

Checks if the given color is valid (white or black).

Parameters
colorThe color to check.
Returns
true if the color is valid, false otherwise.

◆ chess_color_opposite()

ChessColor chess_color_opposite ( ChessColor  color)

Returns the opposite color (white <-> black).

Parameters
colorThe color to invert.
Returns
The opposite color.