From 9b712de308e150cc70cf7571c9debfff17978fd2 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Tue, 23 Feb 2021 20:52:24 +0100 Subject: voerbak 2.1.3 --- voerbak/board.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 voerbak/board.h (limited to 'voerbak/board.h') diff --git a/voerbak/board.h b/voerbak/board.h new file mode 100644 index 0000000..9b4c2f6 --- /dev/null +++ b/voerbak/board.h @@ -0,0 +1,47 @@ +#pragma once +#include + +/** + * @brief Structure to store a board + * + * @param width Board width + * @param height Board height + * @param length Board state array length (width * height) + * @param board Board state array + */ +typedef struct { + int width; + int height; + int length; + int* board; +} Board; + +/** + * @brief Create new board + * + * @param width Board width + * @param height Board height + * + * @return Empty board + */ +Board* createBoard(int, int); + +/** + * @brief Print the board array + */ +void printBoard(Board*); + +/** + * @brief Check if the board is full (draw) + * + * @return `true` board is full + */ +bool boardFull(Board*); + +/** + * @brief Drop a disc into the board + * + * @return `true` if drop was successful, `false` if column full + */ +bool dropFisje(Board*, int, int); + -- cgit v1.2.3