diff options
| author | Kai Stevenson <kai@kaistevenson.com> | 2023-03-19 23:20:53 -0700 |
|---|---|---|
| committer | Kai Stevenson <kai@kaistevenson.com> | 2023-03-19 23:20:53 -0700 |
| commit | e33dc4755fb08ed08f30b5e1af65457556d5bcb7 (patch) | |
| tree | c075e9c4f076a7772eb5c0665fbd137e2fd6c3ab /src/chesshelpers.h | |
| parent | 26321477ae47bbf5d89b651842d8295e9ea9ea5d (diff) | |
fscomch--communication between multiple chess processes
Diffstat (limited to 'src/chesshelpers.h')
| -rw-r--r-- | src/chesshelpers.h | 31 |
1 files changed, 31 insertions, 0 deletions
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 |
