From e33dc4755fb08ed08f30b5e1af65457556d5bcb7 Mon Sep 17 00:00:00 2001 From: Kai Stevenson Date: Sun, 19 Mar 2023 23:20:53 -0700 Subject: fscomch--communication between multiple chess processes --- src/chesshelpers.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/chesshelpers.h (limited to 'src/chesshelpers.h') diff --git a/src/chesshelpers.h b/src/chesshelpers.h new file mode 100644 index 0000000..b3a3d21 --- /dev/null +++ b/src/chesshelpers.h @@ -0,0 +1,31 @@ +#include "vector.h" +#ifndef CHESS_HELPERS +#define CHESS_HELPERS +typedef enum { + pawn = 1, + knight = 2, + bishop = 3, + rook = 4, + queen = 5, + king = 6, +} piece_t; +typedef struct BoardState { + int** pieces; + //only falsified by moving the king or pawn + //does not consider check or empty squares + int whiteCanCastleKingside; + int whiteCanCastleQueenside; + int blackCanCastleKingside; + int blackCanCastleQueenside; + int lastPawnMove; +} board_t; +board_t init_board(int** pieces); +board_t make_move(board_t board, vector_t origin, vector_t end); +board_t clone_board(board_t board); +int in_board(vector_t position); +int is_empty(board_t board, vector_t position); +int is_color(board_t board, vector_t position, int color); +int would_have_been_pawn(board_t board, vector_t position, int color); +char* get_readable_coords(vector_t position); +char* get_move_name(board_t board, vector_t origin, vector_t end); +#endif -- cgit v1.3.1