prob. finished the pseudocode in main.c
This commit is contained in:
+32
-1
@@ -18,9 +18,35 @@
|
||||
#define BOARD_HORIZONTAL 8
|
||||
#define BOARD_VERTICAL 8
|
||||
|
||||
// just a simple type abstraction
|
||||
// type abstractions
|
||||
typedef int board_t[BOARD_HORIZONTAL][BOARD_VERTICAL];
|
||||
|
||||
typedef enum {
|
||||
NONE,
|
||||
PAWN,
|
||||
ROOK,
|
||||
KNIGHT,
|
||||
BISHOP,
|
||||
QUEEN,
|
||||
KING
|
||||
} piece_e;
|
||||
|
||||
typedef struct {
|
||||
int x;
|
||||
int y;
|
||||
} pos_t;
|
||||
|
||||
typedef enum { WHITE, BLACK } player_e;
|
||||
|
||||
typedef struct {
|
||||
// what
|
||||
// where from
|
||||
// where to
|
||||
piece_e piece;
|
||||
pos_t from;
|
||||
pos_t to;
|
||||
} move_t;
|
||||
|
||||
// the default arrangment of pieces on the board
|
||||
#define BOARD_DEFAULT_CONFIG \
|
||||
{\
|
||||
@@ -33,6 +59,11 @@ typedef int board_t[BOARD_HORIZONTAL][BOARD_VERTICAL];
|
||||
{2,3,4,5,6,4,3,2}\
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
CHECKMATE,
|
||||
STALEMATE
|
||||
} end_condition_e;
|
||||
|
||||
// initializes the board with the default configuration of pieces
|
||||
bool init_board(board_t *board);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user