WIP refactor

This commit is contained in:
Ole Morud
2023-03-22 20:35:43 +01:00
parent 39f9d848b5
commit f18c9215e5
11 changed files with 464 additions and 430 deletions

26
common.h Normal file
View File

@@ -0,0 +1,26 @@
#include <stdint.h> /* int32_t */
#include <stddef.h> /* ptrdiff_t */
#include <stdbool.h> /* true, false, bool */
/** Type representing piece/tile on a chessboard */
typedef int32_t tile_t;
/** Type representing index of a chessboard tile */
typedef ptrdiff_t index_t;
#define BOARD_SIZE ((index_t)(8 * 8))
#define WHITE 1
#define BLACK -1
#define E ((tile_t)0) ///< empty tile
#define K ((tile_t)1) ///< king
#define Q ((tile_t)2) ///< queen
#define R ((tile_t)3) ///< rook
#define B ((tile_t)4) ///< bishop
#define N ((tile_t)5) ///< knight
#define P ((tile_t)6) ///< pawn
#define ROW ((index_t)8)
#define COL ((index_t)1)