diff --git a/Makefile b/Makefile index db67a8d..ac38494 100644 --- a/Makefile +++ b/Makefile @@ -9,4 +9,7 @@ build: run: make -B build - $(OUT) \ No newline at end of file + $(OUT) + +clean: + rm -fr $(OUT) \ No newline at end of file diff --git a/build/chess b/build/chess deleted file mode 100755 index 22d87b2..0000000 Binary files a/build/chess and /dev/null differ diff --git a/src/chess.c b/src/chess.c index e80738d..573f838 100644 --- a/src/chess.c +++ b/src/chess.c @@ -1,8 +1,5 @@ #include "chess.h" -#include -int board[BOARD_VERTICAL][BOARD_HORIZONTAL]; - -bool init_board() { +bool init_board(board_t *board) { } \ No newline at end of file diff --git a/src/chess.h b/src/chess.h index ab1cbd4..b5a028d 100644 --- a/src/chess.h +++ b/src/chess.h @@ -12,9 +12,14 @@ * 6 - king */ +#include + +// board size constraints #define BOARD_HORIZONTAL 8 #define BOARD_VERTICAL 8 -//int board[BOARD_VERTICAL][BOARD_HORIZONTAL]; + +// just a simple type abstraction +typedef int board_t[BOARD_HORIZONTAL][BOARD_VERTICAL]; // the default arrangment of pieces on the board #define BOARD_DEFAULT_CONFIG \ @@ -29,6 +34,6 @@ } // initializes the board with the default configuration of pieces -bool init_board(); +bool init_board(board_t *board); #endif // CHESS_H \ No newline at end of file diff --git a/src/main.c b/src/main.c index 1d0edd9..c6424b5 100644 --- a/src/main.c +++ b/src/main.c @@ -1,7 +1,29 @@ // a chess implementation in pure C :) -#include +#include "util.h" +#include "chess.h" + +/** + * steps to victory: + * 1. init the board with the default config + * 2. game loop + * 2a. select the current player (if first round - white starts) + * 2b. wait for the movement of the current player + * 2c. once a move is registered, perform it IF POSSIBLE + * 2d. check for captures and/or promotions and/or mates (check, stale...) + * 2e. if there is an end condition that is met, end the game; announce + * the results +*/ int main() { + board_t board; + bool running = true; + init_board(&board); + + while (running) { + + } + + return EXIT_SUCCESS; } \ No newline at end of file diff --git a/src/util.h b/src/util.h index 1aa2989..ab25d30 100644 --- a/src/util.h +++ b/src/util.h @@ -1,4 +1,9 @@ #ifndef UTIL_H #define UTIL_H +// misc. defines and methods + +#define EXIT_SUCCESS 0 +#define EXIT_FAILURE 1 + #endif // UTIL_H \ No newline at end of file