generate Direction Consts

This commit is contained in:
2024-03-13 11:03:29 +01:00
parent 79419d2007
commit e21fabb94c
9 changed files with 81 additions and 44 deletions

37
include/chess/types.h Normal file
View File

@ -0,0 +1,37 @@
#ifndef CHESS_TYPES_H
#define CHESS_TYPES_H
#include <stdbool.h>
#include <stdint.h>
#define BOARD_SIZE 8
#define TOTAL_BOARD_SIZE BOARD_SIZE * BOARD_SIZE
#define LENGTH(array) (sizeof array / sizeof *array)
#define NOT_SELECTED UINT_LEAST8_MAX
enum pieces {
ALL_PIECES,
KING,
QUEEN,
ROOK,
BISHOP,
KNIGHT,
PAWN,
PIECES_LENGTH
};
enum color {
BLACK,
WHITE
};
struct piece_t {
uint_least8_t type;
bool color;
};
enum directions {
NORTH, NORTHWEST, WEST, SOUTHWEST, SOUTH, SOUTHEAST, EAST, NORTHEAST, DIRECTION_LENGTH
};
#endif