diff options
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 |
